NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: wasatchconsulting on August 11, 2021, 10:36:14 AM

Title: Sending Token
Post by: wasatchconsulting 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
Title: Re: Sending Token
Post by: Bruce 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
Title: Re: Sending Token
Post by: wasatchconsulting on August 12, 2021, 03:54:24 PM
Thanks Bruce, that did the trick.