How to switch from Twitter API 1.0 to 1.1 - api

Twitter API 1.0 doesn't need an access token. The following line returns a XML file:
https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=neodev2010
Result: Valid XML
Cause API 1.0 is deprecated we need to switch to API 1.1:
https://api.twitter.com/1.1/statuses/user_timeline.xml?screen_name=neodev2010
Result: Error: Bad Authentication data
I just found examples for API 1.1 based on large PHP classes.
How is it possible to authentication via GET parameters?
Which parameters are missing to get a valid response?
access_token=123
access_secret=345
oauth_access_token=678
oauth_access_token_secret=910
consumer_key=234

You can't authenticate to Twitter via a simple GET request. You need to use their OAuth system which involves passing a few pieces of information back and forth.
I strongly advise you to find a script or a library where someone has already implemented OAuth and build your application on that. OAuth is not easy to implement, and there's no reason to write new OAuth implementations when there are so many available for free.

REST API 1.1 only support 'json' format of output.
SO use following endpoint along with your authentication data
https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=neodev2010

Related

Need to test Speakatoo API on Postman

I am looking to test my Speakatoo API credentials for my Text to Speech setup in my CRM. I have referred the API documentation however, I am not getting the JSON response as expected.
Can someone guide me how can I first setup the test on postman and then implement for my PHP application.
I tried to include the raw request as below:
{
"username":"cyro***#gmail.com",
"password":"*********",
"tts_title":"testing_API",
"ssml_mode":"0",
"tts_engine":"neural",
"tts_format":"3gp",
"tts_text":"Text for synthesize",
"tts_resource_ids":"TRDu7S1e63c6f288f85180a9130c4e5e10f39dc7fsmJ1XYfxH",
"synthesize_type":"save"
}
I guess, you should take the raw JSON body and test with your credentials. Don't forget to pass header Authorization else it won't work.
You may also implement in your application and it should work. Additionally, you can always contact their support team.

Custom authentication with Swashbuckle.AspNetCore

Currently we're generating Swagger 2.0 documentation using Swashbuckle.AspNetCore. The authentication mechanism being used requires three headers:
X-API-KEY: The shared key
X-API-SIGN: Signature of the request composed of HMACSHA256 hashed value of Hashed secret, Timestamp, Method, Endpoint, and Body
X-API-TIMESTAMP: This is the same timestamp used in the signature
I don't think Swagger or Swashbuckle support this natively so I would likely need to set up some javascript to fill in hidden fields or something in the swagger docs.
I'm currently using an OperationFilter to prepend operation parameters to each request. This doesn't help me once the page loads though since the user will need to enter their API key and secret, which everything else is calculated based on. Clearly javascript will be required here.
Can anyone provide suggestions for how to handle this cleanly?
I wanted to put this as a comment but comments do not allow format so here you go:
The Swashbuckle.AspNetCore seems to be missing the InjectJavaScript feature:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/search?l=C%23&q=InjectJavaScript
It is there on the older project:
https://github.com/domaindrivendev/Swashbuckle/search?l=C%23&q=InjectJavaScript
That is what I've used to inject some javascript, without that we are very limited.
Now looking at this from a different perspective:
It seems you want to embed the authentication process on the swagger ui...
Maybe on the backend you should bypass the authentication if the request comes from Swagger-Ui

How to get OAuth 2.0 right for consuming external APIs in my Custom API .net core

I want to create a custom API that behind the scenes, call number of other APIs which use OAuth 2.0 for authentication. I want to manage this internally so that my custom endpoint somewhat abstract this.
Or to begin with I want to do what app like buffer (https://buffer.com) do - where you connect to different social services and than post your status.
How can I achieve this in .NetCore ?? I don't want to login with these (a lot of samples are catering this scenario), user login is different than this. I just want to establish these connections (like API Connections if you look at Azure API Management) and then perform some operations against those endpoints.
I hope i convey my point. please let me know if this isn't clear.
Thanks
Sanjay
OAuth2 systems are all based on the same workflow.
here's an authorization url, you pass some ids in an authorization header, if everything is correct you get a token, you then use the token to do whatever you are allowed to do. What changes are the credentials you use for authentication and the urls you hit for the various parts of this workflow.
You could write your own OAuth2 library which deals with all this, that's pretty much what I did and simply changed the details for every specific system I had to interact with.
This being said you can always use one of the existing implementations to connect to the various systems you care about, they all have an API you could use, all you have to do is make sure you follow the OAuth2 flow correctly.

To integrate with Silverpop

Can anyone guide how to integrate with Silverpop, using OAuth(tokens)?
I referred this link
connecting to web api using c#
and I was able to get access token. After this I don't know how to proceed.
Thanks.
Take a look at my github repo:
https://github.com/marcelluseasley/IBM-Marketing-Cloud-XML-API-Wrapper
It isn't finished, but I started working on an XML API wrapper for the Silverpop API. First of all, if you are trying to integrate with the API, you should be able to contact client support and get a copy of the API PDF.
In any case, you should have a client id, client secret, and refresh token. You will need these three things along with a header value of "refresh_token" for the "grant_type" header key.
So you will first sent a post to https://api(pod number).silverpop.com/oauth/token . This will return an access token in a json dictionary ("access_token").
Any subsequent calls made to the API endpoint (https://api(pod number).silverpop.com/XMLAPI will require that you pass this access token in the header section of your request:
"Authorization:" would be the header key and
"Bearer: (access token)" would be the header value
Looking at my code will make it clearer if you are using Python. Your best bet is to get a copy of the API documentation. You have to be a Silverpop client to get a copy though.
Good luck.
Check the follwing:
http://www.codeproject.com/Articles/758362/SilverPop-Integration
Follow the step by step guide.

How to make twitter api calls using access token

I have managed to get an access token from the twitter api. Now I want to use that token for my further data fetching things, so please help me here to get the details of my twitter account.
For example, lets say I wanted to get the user's data, so when I tested this in apigee console, I got my result.
But how to get the same result, using same api, by hitting on a browser using the access token
something like this
Please help
It's a little more complex than the URL you suggested, but you can use Twitter's OAuth tool to generate the OAuth signature you need to make requests to its Home Timeline API call.
You can find the OAuth tool here:
https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline#oauth-tool
it's not like that when making twitter api calls you need to send consumer key, consumer secret, your_access_token and your_access_token_secret together
Eg: oauth_consumer_key="KEY",oauth_signature_method="HMAC-SHA1",oauth_timestamp="TIMESTAMP",oauth_nonce="NONCE",oauth_version="1.0",oauth_token="YOUR_TOKEN",oauth_signature="SIGN"
Source: https://twittercommunity.com/t/getting-the-user-details-using-access-token/6325/3