facebook postcard and payload - facebook-oauth

I am having a native application in facebook. I tried to post to a user wall using the following header format
https://graph.facebook.com/100002944254185/feed?message=today
Authorization: OAuth oauth_version=1.0,oauth_nonce=5887e5b11904194f7d217e9b7f795d62, oauth_timestamp=1317623602,
oauth_consumer_key=129042607197622,
oauth_token=AAAB1XRLDTbYBAIfcTKw3mowkwjld89A4K7JVQHZAOM60Tmb8za6wjNq8sPTuHhiAVojKyXm9r1SB3OWlSkKWI2sn9lSAwQGE0giA0UTgCfgXcd0ZCe, oauth_signature_method=HMAC-SHA1,
oauth_signature=GKl%2Bvf3Vaq25XY7dTnb%2FJg3fip8%3D
Content-Type: application/X-WWW-form-urlencoded
when executing getting an error as
HTTP/1.1 400 Bad Request
WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "Expected 1 '.' in the input between the postcard and the payload"
Can anyone say what does this mean?

Instead of https://graph.facebook.com/100002944254185/feed?message=today and then the messy Authorization tags below it, just append the access_token onto the querystring of the https call so it looks like https://graph.facebook.com/100002944254185/feed?message=today&access_token=xxxx and HTTP Post that.

Related

Magento REST API - "Invalid Content-Type header" on POST method

I am trying to run a POST call to create a new customer on Magento from another platform using "http://magentohost/api/rest/customers".
The request failed with this message:
{"messages":{"error":[{"code":400,"message":"Invalid Content-Type header"}]}}
Yet I specify well the Content-Type as follows:
Accept: application/json
Content-Type: application/json
Authorization : ...
body is something like this:
{"website_id":"1","email":"test#test.com","telephone":"","group_id":"1","prefix":"Mme","firstname":"test","lastname":"test"}
the request works fine when I fire it from chrome rest client with the same settings.
also GET method works fine.
If some one encountred the same issue please help !

Parse API GET Request

If I have a Parse.com API with applicationId APPLICATION_ID and REST-API-Key REST_API_KEY, and the classname is Story, then what should the GET request structure look like. I tried the following :
https://api.parse.com/1/story/applicationId=APPLICATION_ID&REST-API-Key=REST_API_KEY
but it didn't work.
#Das According to Parse API
Authentication is done via HTTP headers.
So, your request should be
*GET /1/stories/story HTTP/1.1
Host : api.parse.com
Accept: application/json
X-Parse-Application-Id: APPLICATION_ID
X-Parse-REST-API-Key: REST_API_KEY*
When we need to use headers, the Get request can not be formed within a single URL,
Postman chrome extension would be helpful to construct the requests
or fiddler.
When you are using postman, to fill the header details, take the HTTP Verb as POST and use
X-Http-Method-Override: GET header to make it a GET request.
Hope this helps

FIWARE-Lab KeyRock Access Token Request error

I'm testing the Authorization Code Grant protocol on the instance of KeyRock GE at FIWARE-Lab using DHC web client.
So far I have succeeded on implementing the Authorization Request, and I obtain the code to be used on the Access Token Request. The URL for the Authorization Request is the following (although not executed on DHC, but on a regular browser so I can introduce my user and password):
https://account.lab.fiware.org/oauth2/authorize/?response_type=code&client_id=2122&redirect_uri=http%3A%2F%2Flocalhost%2FCallback
I have checked that the client_id and the redirect_uri are both correct against the values related with my application at my account at FIWARE-Lab.
Executing the following request (can't post images, so I'll describe)
POST
https:// account.lab.fiware.org/oauth2/token?grant_type=authorization_code&code=<code>&redirect_uri=http%3A%2F%2Flocalhost%2FCallback -- <code> is the code obtained on the Auth. Request
Authorization: Basic <XXXX> --- <XXXX> is the result of base64(client_id+":"+client_secret)
Content-Type: application/x-www-form-urlencoded
...I get the following error message:
{
"error":{
"message": "create_access_token() takes exactly 3 arguments (2 given)",
"code": 400,
"title": "Bad Request"
}
}
I've checked the authorization is correct (Basic using the OAuth credentials from my application), and I'm using the same redirect_uri used at the previous Authorization Request, and the code obtained from it.
¿What is wrong?
P.S.: If I remove any or all of the query parameters, I still get the same error
Don't pass the parameters in the url. Instead, add them to request's body as query string:
POST /oauth2/token HTTP/1.1
Host: account.lab.fiware.org
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <XXXX> --- <XXXX>
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=1234&redirect_uri=http%3A%2F%2Flocalhost%3A9000%2Fcodecallback.html
I suggest to follow the steps in the presentation:
Adding Identity Management and Access Control to your Application
It gives you details about what are the different requests that you have to follow and also what are the expected response of them.

Testrail Bad Request error when using add_run method in API

I'm attempting to use the add_run API method to create new test runs on my testrail server. I am using RESTClient to test the command.
The request is POST index.php?/api/v2/add_run/1
(I have a project with id 1)
As request headers I am using Content-Type: application/json and Authorization: Basic USERNAME:PASSWORD_BASE64
request body is:
{
"name":"name",
"suite_id":1
}
Upon sending the request, I receive a "400 Bad Request" Response with the error message:
{"error":"Content-Type header invalid (use Content-Type: application\/json)"}
Since I am in fact using Content-Type: application/json as a request header I have no idea why I am getting this error or what it means. Anyone have any ideas?
one of the TestRail developers here. It's very likely that you didn't submit the Content-Type header correctly, could you please share the source snippet you used to send this request?

Error when attempting a PUT against /users/USERID endpoint in 2.0 API

I've seen others with the same issue ... I get the following json error message back whenever I attempt to disable a user or update their title. Has anyone had luck with this?
I have no problems with the POST method to add an email_alias, or with the PUT method to move a users folder from one owner to another. I've tried it in perl and in curl (see below example session) So I'm relatively confident that :
I have a valid, OAuth2 bearer token
I have properly formed content and URLs
So, I'm trying to post to:
PUT /2.0/users/XXXXXXXXXX HTTP/1.1
Authorization: Bearer TOKEN
Response:
HTTP/1.1 400 Bad Request
{"type":"error","status":400,"code":"invalid_request_parameters","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Invalid input parameters in request","request_id":"1682580609514902d69b5fd"}
Update: below is a trace from curl showing the request body:
0000: PUT /2.0/users/USERID HTTP/1.1
00a2: Authorization: Bearer TOKEN
011f:
=> Send data, 23 bytes (0x17)
0000: {"status" : "inactive"}
<= Recv header, 26 bytes (0x1a)
0000: HTTP/1.1 400 Bad Request
<= Recv data, 207 bytes (0xcf)
0000: {"type":"error","status":400,"code":"invalid_request_parameters"
0040: ,"help_url":"http:\/\/developers.box.com\/docs\/#errors","messag
0080: e":"Invalid input parameters in request","request_id":"718513715
00c0: 514916f1109c2"}
Found the answer to the 4xx errors on PUTs : the OAuth2 settings for the application in box needed to have "Manage Enterprise" checked ... my app has been around since the pre-OAuth2 days, wasnt aware of this flag.
After checking it, i get 200 response ... some PUT operations still dont effectively change the attribute, but they return a 2xx response, so, one hurdle cleared.