I'm using Spring Social Facebook (Java) to call Graph API methods for friend lists, using an app-specific access_token that contains all available permissions.
I can create a list and add members to it. But when I want to remove a member,
DELETE https://graph.facebook.com/{LIST_ID}/members/{USER_ID}?access_token={ACCESS_TOKEN}
...the call fails with a 400 error.
I tried calling the same 'delete' URL from my own java client code (Jersey) and got the same 400 error:
400 Bad Request
Method Not Implemented
Invalid method in request
But the same 'delete' URL works no problem if I use it:
- in the Graph API debug tool
- in the "RESTClient" Firefox extension
Any ideas why the java code is having trouble with this delete call?
I ended up using a batch request (even for a single call) and it worked fine. Probably a bug.
https://developers.facebook.com/docs/reference/api/batch/
Related
I am trying to create a create a GET request in the API Gateway console but I keep geeting an error, and I don't understand why.
The request I am trying to create is the following:
GET /user/{user-id}
I am able to create the resource for this request, however, the moment I try adding the GET method in it, I keep getting the following error:
Expected params.requestParameters['method.request.path.user-id'] to be a boolean
I don't really understand why this is happening, and my google searches have not been helpful.
Here is a screenshot of the resource creation for /user/{user-id} in api gateway:
Edit: I tried testing it with just a normal GET request using a normal endpoint (without a path parameter) and it seems to be working just fine. This leads me to believe that I am definitely doing something wrong with the path parameters.
I have a lambda (node) function that works fine when I invoke it using postman but not when I used jquery $.ajax.
The function is being called from a local html page using javascript/jquery.
I have the 'Allow-Control-Allow-Origin' chrome plugin enabled.
The request passes the same json object using possman and jQuery.
{
"deviceid" : "ZZ-5A-04-A6-XX-YY"
}
I tried the following gateway request mapping templates.
$input.json('$')
When I log the even node object I see the following line
deviceid=ZZ-5A-04-A6-XX-YY
$input.body
I get the error:
Could not parse request body into json: Unrecognized token
Solved this finally.
In addition to using the chrome allow cross origin plugin the data object needs to be send as a string when using jquery ajax.
data: JSON.stringify(hardobj)
Hope someone else does not have to waste a week trying to figure this one out.
I have the following API downloaded in JSON from Swagger Editor:
PUT http://10.37.64.243/m2m/fim/items/fim:device:manager/operations/getAllDeviceTypes?exclude={{exclude}}
with exclude being an environment variable set as : href,metadata,name,arguments
Nominal use requires basic authentication, in this case it works and I get a JSON body with expected result. It properly works in Postman (so I think my import is correct)
If no authentication is provided:
in Swagger Editor : nominal behaviour, request is rejected with error code 401
in Postman : UNEXPECTED behaviour, I end up with status code 200 and it returns a response body identical to the one that I get when authenticated
if I generate the cURL code snippet from Postman and launch it out of Postman: nominal behaviour, I get the same error as the one I get in Swagger Editor (the one expected)
Why do Postman behave differently from the cURL request ??
I probably do something wrong, but I can't figure out what
Thanks for any help
Alexandre
I finally found out that the server returns a cookie that holds authentication validation. So after a valid authentication, whatever the request (with or without authentication) it will be considered as authentified.
Unfortunately, the only way to overcome that problem is to remove the cookie by hand through the "Manage cookies" window. Postman does not implement a function that erase it (even through the pm.cookies and pm.cookies.clear() function).
Postman developpers are aware of that, but there's no scheduling for this feature ...
EDIT: the feature is followed here https://github.com/postmanlabs/postman-app-support/issues/3312
I am trying to setup a simple API test against a local endpoint. I have create the sample API (phone number lookup) and that works fine.
http://192.168.1.11:8080/api/simpleTest is my endpoint and the WSO2 service also runs on 192.168.1.11 ... but when I test it in 'publisher', it always fails. This is a simple GET with no parameters.
I can run it from a browser or CURL (outside of WSO2) and it works fine.
Thanks.
I assume you talk about clicking the Test button when providing Backend Endpoint in API publisher.
The way that Test button works at the moment (as far as I understand) is that it invokes HTTP HEAD method on the endpoint provided (because according to RFC 2616, "This method is often used for testing hypertext links for validity, accessibility, and recent modification.")
Then it checks response. If response is valid or 405 (method not allowed), then the URL is marked as Valid.
Thus sometimes, if backend is not properly following RFC, you might get otherwise working URLs declared as Invalid during the test because of that improper HEAD response evaluation. Obviously, this is just a check for your convenience and you can ignore the check if you know the endpoint works for the methods and resources you need it to work.
P.S. Checked it on API Cloud but behavior is identical to downloadable API Manager.
Did Google recently change the return code sent to clients when the delete member call is invoked with a memberKey parameter that does not represent a current member of the group from 404 Not Found to 400 Bad Request?
I tested using the Admin SDK Explorer found at this page: https://developers.google.com/admin-sdk/directory/v1/reference/members/delete . I used the group's email address as the groupKey and a user's (non-member) email address as the memberKey.
If so what is the best way for developers to become aware of such changes?
Scouring the Admin SDK reference returned no results for error/response code definitions. This is a serious missing feature of the documentation. I'm unsure how Google expects developer to handle errors when we can't know what the errors will be.
That said, I receive a 404 Not Found when invoking a groups.list call with an invalid memberKey. A 400 Bad Request sounds like the structure of the call is at fault based on a description of that error code for the Analystics API. Could you post the code for your API call?
In response to your edit: It appears that the delete member call expects a user that is a current member of the groupKey group. If you are getting the same result (400 Bad Request) using the SDK Explorer then I guess that means the response code changed. If the Explorer gives you a 404 Not Found response, then it is likely a syntax error in your request code.