This thread has been locked.

Failing to generate API token via JSON command in Insomnia (FORM works)

Other Parts Discussed in Thread: TI-API

Hello,

I am attempting to generate an API token via JSON script in Insomnia. 

FORM access worked fluently with below response, so I assume my ID and SECRET are correct:

When using JSON, I get a 401 UNAUTHORIZED response:

JSON script has been taken 1:1 from:

TI store API suite - Authentication | TI API Portal

Thanks for help resolving this. 

Rainer

  • Hello Rainer,

    Thank you for your post - for future new posts, please enter Part Number = TI-API to ensure your inquiry is automatically routed to the experts.

    Thank you,

    ~Leonard 

  • Thank you, Leonard, fair point. Can I edit my post to add the Part Number? Thanks. 

  • Rainer:

    I have send you private message to get more info before I can help you further. 

    ~Samip

  • Resolved!
    Thank you for your support, Samip.

    I understood that Insomnia doesn't accept CURL commands and the example on the API Portal is CURL, not JSON. 
    The resolution was to verify that CURL is installed on my Windows machine (check) and CMD prompt is accepting CURL commands (check).

    After these steps, entering the curl command in this form

    • curl --request POST --url "">transact.ti.com/.../accesstoken" --header "Content-Type: application/x-www-form-urlencoded" --data grant_type=client_credentials --data client_id=[ID GOES HERE]--data client_secret=[SECRET GOES HERE] 

    has worked and produced the desired answer with the API token

    • {
      "access_token": "TOKEN OUTPUT HERE",
      "token_type": "bearer",
      "expires_in": 3599,
      "scope": "",
      "application_name": "APP NAME OUTPUT HERE",
      "developer.email": "",
      "issued_at": "TIMESTAMP OUTPUT HERE",
      "client_id": "CLIENT ID OUTPUT HERE"
      }

    Again, thank you for this resolution.
    BR,
    Rainer

**Attention** This is a public forum