Application/Json error when sending Gmail with Postman - json

I'm trying to send a Gmail with Postman but got this error:
These are my configured headers:
I have configured everything needed on Google Cloud engine (Oauth permissions, certifications...etc), read similar posts, and also tried testing from gmail API playground and everything was ok:
Any idea of what could be wrong?

Remove all custome headers , (Create a new request by following below steps)
Steps:
https://console.developers.google.com/ Goto url and create an API. (by clicking credentials>create credentials)
https://console.developers.google.com/apis/api/gmail.googleapis.com/overview Goto url, click credentials> create new 0auth0.2 ( select applicaiton type as Web application)
While creating 0auth0.2 scroll down and set Authorized redirect URIs as https://localhost
CLick the download as json and then save the auth
Open postman and set authorization as 0auth2.0 from authorization header:
Generate new token by filling the content as per the downloaded json ( open the json and fill postman as in json)
set scope and state as : https://mail.google.com/ ( full access ) see scope at : https://developers.google.com/gmail/api/auth/scopes
In postman Set url as :https://gmail.googleapis.com/gmail/v1/users/praveendvd0pravu%40gmail.com/messages/send?key={YOURAPI_KEY_That_was_generated}
goto https://www.base64encode.org/ , and paste below content and click encode. Copy the output.
From: youremail#gmail.com
To: tosomeemail#gmail.com
Subject: Hi
Hi this is
9): paste it as json body
{
"raw":"IEZyb206IHlvdXJlbWFpbEBnbWFpbC5jb20KIFRvOiB0b3NvbWVlbWFpbEBnbWFpbC5jb20KIFN1YmplY3Q6IEhpICAKICAgIApIaSB0aGlzIGlzIA=="
}
Send it :

Related

How to call API in Command Line Interface

I have an API URL which looks like this https://my.domain.com/api/users, but when i try to access it through web I got blank page,
and when i try curl i got nothing, how do i access it to view content of the users? I have api_key and accessToken
This is what i have done so far:
curl https://my.domain.com/api/users
I have an API URL which looks like this https://my.domain.com/api/users, but when i try to access it through web I got blank page,
and when i try curl i got nothing, how do i access it to view content of the users? I have api_key and accessToken
This is what i have done so far:
curl https://my.domain.com/api/users

How to use Postman and the FIWARE API?

Some of the tutorials of the FIWARE Wednesday Webinars e.g. this one https://youtu.be/SP0zFdTybA4, show the use of Postman to interact with the FIWARE API. I am not sure what configuration needed to get it up and running.
I could use the curl command but when run the postman. I am new to both FIWARE API and Postman.
Can anyone show me how to configure Postman to use with FIWARE API? Thanks.
Install Postman
Check out one of the Tutorials
At the top of the Tutorial, there is the option "Run in Postman"
Postman will open and you will see the collection e.g. "FIWARE Getting started"
If you Fiware system runs at a different server than localhost, e.g. example.com you need to modify the variable {{orion}} in the collection
Click on the three dots at the collection, then choose Edit and in the Variables tab overwrite Current value with your server address.
Install and launch Postman.
Change the request operation as required(POST, GET, APPEND, etc).
Enter the public IP Address of required node, with full path.
For example:
In case of POST request to iotagent-json: http://<Ip Address>:7896/iot/json?i=<deviceID>&k=<api-key>
In case of GET request from Orion context-broker: http://<Ip Address>:1026/v2/entities
Add headers(-H) in Headers tab:
Add fiware-service, fiware-servicepath, content-type and its values.
Default value of fiware-service is openiot and fiware-servicepath is /.
If request type is POST, add data payload in Body tab, also choose aplication/json as content type from the dropdown menu.
Send to hit the given API.
One can also import CURL request statement in Postman:
Open Postman Application
Click Import, located on top-left corner
From Import, select tab “Paste Raw Text”
Copy and paste the CURL request data to the given input area below “Paste Raw Text” tab.
Click Import located at the bottom-right
Check whether data type is application/json or not in body tab, if not select
application/json from the drop-down menu in body tab.
Click “Send” button to post the data."
For more detail, refer to my config:
POST Request on iotagent-json
GET Request from Orion context broker

How do I handle html response from oauth2 token request?

In my angular 6 application, I’m trying to send a request to get an access token from an oauth2 provider called anilist. I’m doing it like this:
this.http.get(url, options).subscribe(result =>
{
console.log('result: ', result);
});
…where http is imported like this:
import { HttpClient } from ‘#angular/common/http';
This results in an error:
SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse
This seems to be because the request is returning an html document (most likely the login page) and it obviously can’t parse it as json.
But then my question is: how does one send a request for an oauth2 token and handle the response as an html page?
Thanks.
It is a bit strange that you want to get access token via http get.
Maybe that is the problem, are you talking about this site? https://anilist.co/
https://anilist.gitbook.io/anilist-apiv2-docs/overview/oauth/authorization-code-grant
The user navigates to their site via your oAuth2 signin link
They sign in, add grant, then the browser redirects to your callback url
You change your auth code to access token via http post request. https://anilist.gitbook.io/anilist-apiv2-docs/overview/oauth/authorization-code-grant#converting-authorization-codes-to-access-tokens
I think you get an html response because
You try to get access token via http get - and here you get an unsupported method / 404 / etc error
Or you are trying to get your access token from the anilist's login page (anilist.co/api/v2/oauth/authorize) instead of the token endpoint (anilist.co/api/v2/oauth/token)
Update
It is the same case, if you are using implicit grant (because you said you are creating an angular app, which can be an SPA - therefore a public client, but in this case the access token is provided in the response) https://anilist.gitbook.io/anilist-apiv2-docs/overview/oauth/implicit-grant

NetSuite RESTlet NLAuth using Postman

I'm new in NetSuite and I tried to make a REST request using Postman I've write in header the NLAuth authorization like the line above:
Authorization : NLAuth nlauth_account=0000000, nlauth_email=at#at.com, nlauth_signature=mypassworld,nlauth_role=3
And i follow the process of this tutorial: https://community.boomi.com/docs/DOC-2676#jive_content_id_To_call_the_getRecord_RESTlet
But I receive the following response:
{
"error": {
"code": "INVALID_LOGIN_ATTEMPT",
"message": "Invalid login attempt."
}
}
Use Postman's built-in Authorization tools to build the correct OAuth1 header: https://www.getpostman.com/docs/v6/postman/sending_api_requests/authorization
It's best practice to use OAuth so credentials are not exposed. NS uses OAuth 1.0.
Realm = NS Account number
Signature Method can be SHA1 or SHA256
Make sure the "Add params to header" is checked.
Always "Update Request" before sending in order to generate proper Nonce/Timestamp
Add the Content-Type = application/json to the headers
Body must be a valid JSON object.
I've used the following doc and it help me: If the URL above don't work click in this link.
URL https://system.xx.netsuite.com/app/help/helpcenter.nl?fid=section_1530099787.html

cannot get document id using box view api

In my app, after get "https://dl.boxcloud.com/*" url and send it to the View API, I receive this error:
{
message: "JSON parse error - No JSON object could be decoded"
type: "error"
request_id: "3ef12abcaf7a4c5abab5fb0d3959255e"
}
you can use this chrome extension to recreate this error
https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
I tried with the other rest clients and it work correctly. Except in my app and the extension above.
I tried with the other rest clients and it work correctly. Except in my app and the extension above.
If this is the case, it's likely that the client you're using isn't actually sending properly formatted JSON. One way to debug this would be to output the raw HTTP request the client is sending and ensuring that it's actually sending the JSON properly.