get request to me/inbox misses first message of the conversation - facebook

I am using Graph API of facebook to read user's messages.
https://developers.facebook.com/tools/explorer?method=GET&path=me%2Finbox
To get the access token, I have selected 'read_mailbox' permission.
On submitting the request, I get the response as JSON string, but the response does not contain first message of the conversation.
What am I missing?
Thanks and Regards,
Arjabh

You missed nothing. The Facebook Graph API returns a thread with all messages. You will need read the parameter "unread" and after parse the JSON content, get the last X ("unread") messages of the thread. They are the unread messages.

Related

POST or GET request to get info from uploaded file?

I'm trying to write an API that would receive a PDF file, process it, and send the results back to the user within the same request.
I'm confused as for which request should be used for this task, as the user is trying to GET a response from the server, but they also POST a file.
In this case, should/can I add a PDF file as a parameter to the GET request, or should I use a POST request - but if the latter, how does the user get the processed result?
GET is usually used to get info that is already on the server, while POST is to send information to the server, and the server responds based on that information.
I think your question should be more focused on whether to use POST or PUT. Take a look at this guide, and act according to your case.

Error message "{responseCode8,responseMessageERROR_INVALID_PAYMENTTOKEN}" is displayed when I call the API for verifying the purchase token

I made a request to verify the purchase token by referring to the official materials, but error message "{responseCode 8 , responseMessage ERROR_INVALID_PAYMENTTOKEN}" was returned. The URL of the request API was {rootUrl}/applications/purchases/tokens/verify. Is there anyone who can help me with this problem?
First, you need to make sure that consuming or confirming a product is performed for a user only when the user has successfully purchased it, that is already owned the product.
Then you also need to ensure that the input parameters in the API call request are correct.
For example,use the wrong site to check that purchaseToken.or The productID is not added to the PMS or is incorrect. and so on.
For more details,you can refer to error codes.

Calling rest API thread safely

I'm calling a third party upload document rest API from my spring controller, and I'm passing some fields in the request to the API where the upload document API returns a response, but that response doesn't have any of the values which I had passed to it.
I need to update my database with the response received.
In Single threaded mode it's OK, but how should I save it in case of concurrent access as sometimes it may be like one response may get saved for another user.
The third party API is rejecting to send back any of the values I pass in the request.
Because it's an official system, I can't provide any code.
But still, we are using a REST template to call the API which will have request parameters like user id, request number, and file as a byte array. And the response that we get is just the file name, and the status as doc upload successful. So when accessed concurrently, it can happen that the status and filename that we get in response will be saved against some other user.
Please advise how can I make my code thread safe as the rest API doesn't send any of the values in response.

Where can I get the request_id?

I want to make a request to this url https://api.uber.com/v1.2/requests/{request_id}/receipt, but I don't know where I get this request_id. Somebody knows?
You would get the request ID from posting a request. More information can be found on making a request here: https://developer.uber.com/docs/riders/references/api/v1.2/requests-post
So the trip flow goes: your app makes a request on behalf of a user, you receive a request ID. After the trip is completed you would the call that URL you specified to provide/get a receipt for that trip.

Twitter+oAuth engine returning 401 when trying to post status

I am using the Twitter+oAuth engine in my iPhone app, and I am able to authenticate the user perfectly. I can get statuses with no issue at all, but when I want to post a status, a 401 error is being returned.
This is how I am sending a tweet: [_engine sendUpdate:#"Testing 101"];
It is returning a "Request failed" message with a HTTP 401 error. When I use the same engine to receive statuses, a request succeeded message is being returned.
Why is this happening?
I can receive statuses perfectly, multiple times a minute. That request is succeeding with no difficulty, but the same engine is returning a 401 when trying to post.
Make sure your callback url is not blank. This callback url does't have to be valid, or even exist.
Try not to submit the same update over and over. Twitter sees this as spam and will eventually refuse to post your updates.
Also, see Twitter Error & Response Codes.
401 Unauthorized Authentication credentials were missing or incorrect.
This leads me to think too, that you aren't logging in or passing the correct credentials before posting.