NetTalk Central

Author Topic: Sending Token  (Read 3206 times)

wasatchconsulting

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
    • Email
Sending Token
« on: August 11, 2021, 10:36:14 AM »
I am using NT12 and I have the following that works great when tested using a curl testing program. It is returning a JSON response.

curl -H "apikey: a123456c-07dd-4bec-974f-b9f7c217f4a6" https://api.aq360.com/project/08-10-2021

In NT I have:
ThisWebClient.ContentType = 'application/json'
ThisWebClient.Authorization = 'Token a123456c-07dd-4bec-974f-b9f7c217f4a6'
ThisWebClient.Get('https://api.aq360.com/project/08-10-2021',PostString)

The response I get back is "Invalid Api Key"
Any ideas of what to change?

Thanks
Ken Watts

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Sending Token
« Reply #1 on: August 11, 2021, 10:13:08 PM »
Hi Ken,

Remove this line;
ThisWebClient.Authorization = 'Token a123456c-07dd-4bec-974f-b9f7c217f4a6'

Add this line
ThisWebClient.CustomHeader = 'apikey: a123456c-07dd-4bec-974f-b9f7c217f4a6'

Change the call to GET to
ThisWebClient.Get('https://api.aq360.com/project/08-10-2021')

Cheers
Bruce

wasatchconsulting

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
    • Email
Re: Sending Token
« Reply #2 on: August 12, 2021, 03:54:24 PM »
Thanks Bruce, that did the trick.