Twitter api statuses/destroy api 401 error - delphi

I'm authenticating with OAuth getting my request token, authorizing, doing POST to get the AccessToken and then pulling my user_timeline.xml
At this point I try and call the destroy api on a particular status id and it returns a 401 unauthorized.
I am able to take the url and the parameters out and call this through Fiddler2 and it works, but using it in a Delphi app with Indy V10 component, doing a POST it's giving this 401 still.
What can I be missing?
Thanks,
david
If I can figure this out this app is good to go, very frustrating.
Please help!

Figured it out. Finally ran a .NET version of code, ran Fiddler2 to see what it did and noticed the Authorization Header. I then had to find a reference to this in regards to the Indy Components to figure it out. You have to add CustomHeaders with a specific format.

You may wanna try my implementation with ICS, supports Unicode as well
http://eden.fm/2011/02/27/twitter-library-for-delphi/

Related

How to test WebService/Restful API in Rest Client?

I know this question may be so simple but still posting here.
I have a WebService/Restful API written in RAILS which gives response in JSON format. According to the RAILS developer, it works fine under his development but not in my case.
My problem is,
Now, I want to test that Request/Response in Browser Rest Client (like
mozilla, chrome). However, when I hit the API there it gives me 401.
So I have 2 questions,
1] How to test it in Rest Client? if I make any mistake while passing header parameter in wrong way.
2] Is there anything other approach to do this?
API Details are,
URL : http://rails4.xxxxx.com/xx/xxxxx/{id}.json
//{id} can be any integer value
header
X-xxxxxx-Client:
487txxxxhu34hfixxxxxu3hfcfxxxxx4f3f3f
For more details, please refer below snaps.
Thanks is advance.
There are a lot of ways to test rest api:
cURL (CLI)
RestConsole (for Chrome)
RestAssured (java test framework)
Frisby (javascript test framework)
Problem was due to wrong credentials.

Why am I receiving a 500 status when trying to connect with ASANA api?

I am using this example: https://github.com/ajimix/asana-api-php-class/blob/master/examples/oauth.php to learn how to use the asana's oauth. I already registered my app on the asana's developers webpage. But, when I get the asana's response with my 'redirect_url'?code=0%XXXXXXX, localhost gives me a 500 status. I don't know why, does anyone know how I can solve it?
I tried using the other examples in there: https://github.com/ajimix/asana-api-php-class/blob/master/examples/, but I wasn't able to make them run either, I always get a 500 status. I think that the problem must be in my server, but I don't how solve it. Maybe changing something on the .htaccess file, but I don't really know what to put in there.
If you're looking to use the Asana API from PHP may I recommend the official first-party client: https://github.com/Asana/php-asana
It also contains examples of how to use with OAuth and is officially supported by us at Asana :-)

How to POST an image to Twitter by statuses/update_with_media in Lua

I have problems building the header and/or body of the http-POST for a Twitter oAuth update_with_media call in Lua.
I'm using multipart/form-data as Content-Type
All oauth_* parameters are included in the body, including an oauth_signature.
POSTing to url https://upload.twitter.com/1/statuses/update_with_media.json
The problem is I have no idea how to successfully add the image data (media[]) to the body, in addition to 'status' and the other oauth parameters.
Also, how do I calculate the Content-Length?
As of yet, I'm constantly getting a 500 Internal Server Error back form Twitter.
Can anyone provide me with a code snippet to add image data (jpg) to a POST? I'm using the Corona SDK btw, if that makes any difference.
If any help, please refer to this issue:
Twitter API `status/update_with_media` return `404 Not Found`
If your still get the 500 error, please refer to this one:
https://dev.twitter.com/discussions/1525

MySpace iOS SDK 401 Error

I'm working on adding support for MySpace in my application, and I think I've written everything correctly, but I seem to be getting a 401 error when the MSRequest delegate method is called. I would be happy to post my source code for those who are willing to help! Thanks, Derek
without seeing your code I can't say much but a 401 is a bad auth code. How do you generate whatever OAuth token you need for their XHR requests? I'd start by looking there, post some source for more help.

Twitter Oauth Delphi 7 home_timeline getting 401 unauthorized

I am using Oauth for Delphi from ChuckBeasley.com
I am able to get a request token, then call with my callback url and put in my credentials.
I then get redirected correctly to my callback url in a TEmbeddedWB component.
I then get an access token (at least I believe I am) since screen_name and user_id come back in the response.
When I try and pull my home_timeline it gives me a 401 unauthorized as a response.
What can I be doing wrong?
Thanks
David
try my implementation, it doesn't use the OAuth library, but my own from scratch
http://eden.fm/2011/02/27/twitter-library-for-delphi/
You're also welcome to use my open-source Twitter component (TTwitter for Delphi) which is being developed as part of a "complete" suite of Social Networking components (if there is such a thing as "Complete" in terms of social networking). You can find it at: http://www.simonjstuart.com/delphi-stuff/ttwitter/
It's using the ChuckBeasley OAuth library, only I have fixed it (so it ACTUALLY WORKS). In the very least you'll be able to reverse engineer my component to suit your needs. It's an open beta (far from complete at its current released stage) but it handles timelines perfectly (including unicode characters).
Enjoy and good luck!

Resources