HTTP API to get session token with Postman

I continue to receive a “Status: Bad Request” regardless of what options I try using in Postman to send a POST to get a session token. This is not my first time using Postman for an API, and I’m usually pretty successful in a short amount of time.

I am sending a POST to: https://api.notefile.net/auth/login

I am sending ‘{“username”:“[you@youremail.com]”, “password”: “[your_password]”}’ as JSON in Postman as shown in the documentation (Using the Notehub API - Blues Wireless Developers) has same result.

I also tried setting Authorization to ‘Basic Auth’ and entering my Notehub username and password returns same response.

I’m starting to think another problem exists. I logged out and back into notehub.io to verify my login credentials. Is using my Notehub login credentials for the API correct?

Hi @markwkiehl,

It looks like you have everything formatted correctly. A couple of things you might try:

  1. Make sure you’re using standard ASCII quotes and not smart quotes—aka "name" and not ”name”
  2. Make sure you’re not including the brackets in your body—aka don’t use [ and ].

Your POST body should look something like this.

{"username":"tj@blues.com","password":"yourpassword"}

You could also try sending the request through curl to see if you have something incorrectly configured in Postman.

TJ

tjvantoll, thank you for trying to help me.

My request is formatted exactly as you suggested. No “” or strange double quotes.

I also have trouble with executing any CLI JSON request (-req), but no problems with requests from the In-Browser Terminal. I’m stumbling and struggling a lot more than I usually do with Notecard / Notehub for some reason.

Any chance my problems are unique to Windows OS? Has anyone successfully performed Notecard CLI requests from Windows OS? How about obtaining a session token with something other than cURL?

It turns out cURL is installed with Windows 10 & 11 OS. I tried the cURL command, and after a lot of reformatting what was published in the Notecard documents, I got the following to work:

curl – verbose --request POST --location https://api.notefile.net/auth/login --data “{"username":"[you@youremail.com]", "password": "[your_password]"}”

Note that the values for “username” and “password” need to be URL encoded., the double quotes within the JSON needs to be escaped, and the JSON needs to be bounded by double quotes for Windows OS.