NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: wasatchconsulting on February 21, 2023, 06:06:19 PM
-
I am working on an interface with an API and have run into a road block.
The API that I am accessing gives examples using Postman. When setting it up in Postman it works great, but it is not working in the WebClient demo.
In Postman you enter the "values" being sent in the "Header" tab. I tried placing these into the net.CustomHeader and net.SetValue, but it will not work. I also placed the json string into the post data with no luck.
I am looking for direction on translating from Postman Headers to NetTalk 12.
Thanks
Ken Watts
Wasatch Consulting Services
-
Hi Ken,
you need to be more specific on what values you are adding to the header (in postman) and how you translated this into your clarion code to setting net.customheader.
CustomHeader is the correct property, I'm guessing you set it wrong, but without specifics I can't be sure.
Cheers
Bruce
-
Here is the code I have tried:
NetItemImport.SetAllHeadersDefault()
NetItemImport.CustomHeader = 'Authorization: Bearer '&CLIP(GLO:AccessToken)
NetItemImport.CustomHeader = 'Accept: application/json'
GLO:URL = 'https://api.lightspeedapp.com/API/V3/Account/'&CLIP(GLO:AccountID)&'/Item.json'
NetItemImport.ContentType = 'application/json'
NetItemImport.Accept_ = 'application/json'
NetItemImport.Post(GLO:URL)
I have attached an image of the Postman setup as well.
Ken Watts
-
Bruce,
I found my mistake and getting the correct response now.
Thanks
Ken Watts