cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "OAuth 1.0 class/method" in abap (Twitter API)

kyoungmi_oh
Explorer
0 Kudos

Hi,

I tried to connect TWITTER in ABAP. so, i used "CURL" below :

CONCATENATE
'curl -i -X POST'
' -H "Content-Type: application/x-www-form-urlencoded"'
' -H "User-Agent: OAuth gem v0.4.4"'
' -H "Authorization: OAuth oauth_consumer_key=our_oauth_consumer_key, oauth_token=our_oauth_token, oauth_signature_method=HMAC-SHA1,'
'oauth_timestamp=1578965221,oauth_nonce=oauth_nonce_value,'
'oauth_signature=' lv_oauth_signature '"' 
' "https://ads-api.twitter.com/6/accounts/12aal5/tailored_audiences?name=audience_name"'  
INTO cmd.

but i've got "401 Authorization Required". when i used POSTMAN, it was successed.

I think there is a problem in the process of making oauth or there is an error in curl syntax.

(twitter api :

https://developer.twitter.com/en/docs/basics/authentication/oauth-1-0a/creating-a-signature)

According to google, there is a class in SAP GUI.

https://www.se80.co.uk/oo-abap/c/cl_a/cl_ar_fnd_jam_oauth1_common.htm

I have to authenticate ads API using OAuth 1.0a. Do those methods work the way I want them to?

If it does, please share the example regarding of OAuth 1.0a.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member226
Employee
Employee

Hi,

You should not use cURL command directly in ABAP to call a Twitter API but rather you should use the standard authentication mechanism to do so. There is a very nice blog as follow

https://blogs.sap.com/2010/08/12/twibap-the-abap-twitter-api/ which talks about how to use oAuth parameter for Twitter API.

Please check https://blogs.sap.com/2016/11/01/twitter-integration-sap-hybris-marketing-campaigns/ where they explain how to integrate whole SAP Marketing with Twitter API for campaign action.

Thanks

Saurabh