When posting the following request
https://graph.facebook.com/oauth/access_token?oauth_version="1.0"&oauth_nonce="5887e5b11904194f7d217e9b7f795d62"&oauth_timestamp="1317623602",&oauth_consumer_key="607197622"
&oauth_token="AQD8Y6xnKqRYThyLowBETEx5-fyr_cqVcmvItdnfgv01B24_WA0ykwRmkJgG6cyQgEJpyXQLIEauF0B24p8oqffoO-brGa2V1H9gASlAazKwOv65CvlbvGsEGd0Dk2VC58iiKGgB7xo7Rf4nL-V-G_buB_nNaHsyLHJJp-j2Rg9_4fmBmic74QrS1VIedU4W5-Sb2K-8oNh8a--mi9lIIyah#_=_"&oauth_signature_method="HMAC-SHA1"&oauth_signature="96be7526390b287e7a32d"
&redirect_uri="https://apps.facebook.com/mymegha/"
getting the following error
{ "error": {
"message": "Missing redirect_uri parameter.",
"type": "OAuthException"
}
}
How to solve this?
Remove the double quotes around the parameters.
access_token?oauth_version=1.0&...
Related
I'm trying to update the label in google contacts using the method from the docs
https://developers.google.com/people/api/rest/v1/contactGroups/update
Got a response
{
"error": {
"code": 400,
"message": "Fingerprint is missing.",
"status": "INVALID_ARGUMENT"
}
}
Even though Google API Explorer
How solve this, maybe someone can help. What does this Fingerprint mean? I can create/delete label but not update!
You have to include the etag.
If you go to Method: contactGroups.get or the Method: contactGroups.list, on the response you will find the groups 'etag'
Then on the Method: contactGroups.update request body you set the new name you want the group to have and also include the etag like this:
{
"contactGroup": {
"name": "newOne2",
"etag": "r*****k="
}
}
I'm trying to create a json file that will hold all the tags for some system logging, like for example:
console.log(`${logs["SYSTEM"].SHUTDOWN} - The bot has been shut down.`)
However, it doesn't allow me to create ANSI color escape characters for some reason.
This is how my logs.json looks:
{
"SYSTEM": {
"SUCCESS": "[\x1B[48;2;0;0;0mSYSTEM\x1B[0m]::[\x1B[38;2;0;255;0m\x1B[48;2;0;0;0mSUCCESS\x1B[0m]",
"RELOADED": "[\x1B[48;2;0;0;0mSYSTEM\x1B[0m]::[\x1B[38;2;0;255;0m\x1B[48;2;0;0;0mRELOADED\x1B[0m]",
"RELOADING": "[\x1B[48;2;0;0;0mSYSTEM\x1B[0m]::[\x1B[38;2;255;158;3m\x1B[48;2;0;0;0mRELOADING...\x1B[0m]",
"ERROR": "[\x1B[48;2;0;0;0mSYSTEM\x1B[0m]::[\x1B[38;2;255;0;0m\x1B[48;2;0;0;0mERROR\x1B[0m]",
"SHUTDOWN": "[\x1B[48;2;0;0;0mSYSTEM\x1B[0m]::[\x1B[38;2;255;0;0m\x1B[48;2;0;0;0mSHUTDOWN\x1B[0m]"
}
}
vs code tells me the error is an "Invalid escape character in string", but I'm not sure how I'm supposed to fix this.
Since the \ is an escape character, I think you just need to double its presence in all the strings.
{
"SYSTEM": {
"SUCCESS": "[\\x1B[48;2;0;0;0mSYSTEM\\x1B[0m]::[\\x1B[38;2;0;255;0m\\x1B[48;2;0;0;0mSUCCESS\\x1B[0m]",
"RELOADED": "[\\x1B[48;2;0;0;0mSYSTEM\\x1B[0m]::[\\x1B[38;2;0;255;0m\\x1B[48;2;0;0;0mRELOADED\\x1B[0m]",
"RELOADING": "[\\x1B[48;2;0;0;0mSYSTEM\\x1B[0m]::[\\x1B[38;2;255;158;3m\\x1B[48;2;0;0;0mRELOADING...\\x1B[0m]",
"ERROR": "[\\x1B[48;2;0;0;0mSYSTEM\\x1B[0m]::[\\x1B[38;2;255;0;0m\\x1B[48;2;0;0;0mERROR\\x1B[0m]",
"SHUTDOWN": "[\\x1B[48;2;0;0;0mSYSTEM\\x1B[0m]::[\\x1B[38;2;255;0;0m\\x1B[48;2;0;0;0mSHUTDOWN\\x1B[0m]"
}
}
I did see this same error, in c# has an open question, but I'm using PowerShell and using POST rather than PATCH so I've opened a separate question.
I'm having an issue when using JSON batching, particularly that when I include the header for Content-Type, I receive:
Invoke-RestMethod : {
"error": {
"code": "BadRequest",
"message": "Invalid batch payload format.",
"innerError": {
"date": "2020-10-14T00:25:46",
"request-id": "aa535dbb-efe8-450e-911d-143554ed9027",
"client-request-id": "aa535dbb-efe8-450e-911d-143554ed9027"
}
}
}
I first had missed including the headers at all, and was receiving the error:
{
"error": {
"code": "BadRequest",
"message": "Write request id : 2 does not contain Content-Type header or body.",
"innerError": {
"date": "2020-10-14T00:46:58",
"request-id": "3601be6d-a861-4947-936b-451cd9de80c3",
"client-request-id": "3601be6d-a861-4947-936b-451cd9de80c3"
}
}
}
The body of my HTTP request to https://graph.microsoft.com/v1.0/$batch is an array of PSCustomObjects that look like this:
id : 1
method : POST
url : sites/8c3cb1ef-4116-b0e4-6d0b-25d0f333a4ed/lists/a2b2d34e-6d32-df22-d562-472d3d8385d2/items
body : {
"fields": {
"DisplayName": "user1#contoso.com",
"CreatedDateTime": "2019-10-13",
"UserId": "c963d785-59fc-4384-5e7d-d466=2118e3347",
"UserType": "Guest",
}
}
headers : {
"Content-Type": "application/json"
}
I found it odd that when I omit headers, the payload is seemingly OK, and it sees that Content-Type has not been supplied. Once I add it in, then suddenly payload is not OK.
If I individually perform the requests, all the same data, it's also fine (items create in SPO list without issue). I feel like this fact confirms that the issue is not with the fields in the body.
I have no issues when batching GET requests (e.g. batching 100's of requests for auditLogs/signIns). These are essentially the same payload, minus no body/headers, so just id, url, and method.
Has anyone had any experienced this and found a solution?
PS. The Guid's are all fakes.
My issue ended up being that I needed to use ConvertTo-Json's -Depth parameter to successfully capture all of my body's content. It was 5 levels deep (Requests: [ Each Request: { body: { fields: { field names/values } } } ]).
This was only an issue with POST method requests, since a body is then needed, which in this case was for adding SPO list items, which requires the fields: key with children names and values for the list's columns / cells.
Getting 500 error when making a https://www.googleapis.com/youtube/v3/playlists request.
I'm using the python implementation provided here:
https://developers.google.com/youtube/v3/docs/playlists/insert.
The same request worked yesterday, so I tend to believe this is not on my side.
Is there anything I might be missing?
The message error usually is more descriptive than the one you put. I had the same problem than you (same message and just yesterday) and tryed a direct call to YouTube API via this page: (you will see a try it pane in the right where you can easily put the call parameters): https://developers.google.com/youtube/v3/docs/playlists/insert
After executing it, I cuolud find the complete error message that was:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"errors": [
{
"domain": "youtube.api.v3.PlaylistInsertResponse.Error",
"reason": "RATE_LIMIT_EXCEEDED"
}
],
"status": "INTERNAL"
}
}
Probably calling the API in that way will give you the full detailed reason of the error.
I have read many RESTful API design pattern resources.
But I'm not confident for deciding API.
It seems there does not not exist a standard JSON response format.
I need advice for my Json error response as below.
401
jwt token related fail
{
code:1,
message: "no access token"
}
{
code:2,
message: "invalid access token"
}
{
code:3,
message: "expired access token"
}
400
client's insufficient input parameter
{
code:20,
message: "input paramter 'search' is missing"
}
client's invalid value request
{
code:21,
message: "invalid serial no"
}
client's invalid request format
{
code:22,
message: "input parameter indate is invalid date format"
}
500
another mesh-up server's problem
{
code:30,
message: "no reply from external server API"
}
program logic error (ex. exception)
{
code:31,
message: "internal server error"
}
For 500 cases, I think client also needs more information.
And another concern is "Is error code needed?"
You could use Problem Details for HTTP APIs.
It's a nice format that can be extended easily to provide the client a good way to react on each error/problem appropriately.
https://www.rfc-editor.org/rfc/rfc7807
Here is an example taken from the RFC:
{
"type": "https://example.com/probs/out-of-credit",
"title": "You do not have enough credit.",
"detail": "Your current balance is 30, but that costs 50.",
"instance": "/account/12345/msgs/abc",
"balance": 30,
"accounts": ["/account/12345", "/account/67890"]
}