Jason,

Try setting up the REST call using the PostMan app at https://www.getpostman.com

It will be much faster to debug how to get your API calls set up properly. It 
was very helpful last month for me to get my REST calls for a Web2Print site 
set up properly.

My calls were generally like this:

//-----------------------------------------------------------------------------------------------------
         
//--------------------- BUILD THE HEADER INFO WE NEED    
----------------------------------------------
//-----------------------------------------------------------------------------------------------------
 ARRAY TEXT($aHeader_Name;0)
 ARRAY TEXT($aHeader_Value;0)
 APPEND TO ARRAY($aHeader_Name;"Content-Type")
 APPEND TO ARRAY($aHeader_Value;"application/json; charset=utf-8")
 APPEND TO ARRAY($aHeader_Name;"Authorization")
 APPEND TO ARRAY($aHeader_Value;"token "+$token)

 
//-----------------------------------------------------------------------------------------------------
                
 //--------------------- SEND THE REQUEST TO PRESSERO     
----------------------------------------------
 
//-----------------------------------------------------------------------------------------------------
 $request:=""           
 $oResponse:=OBJ_Create 
 
$URL:="https://admin.chi.v6.pressero.com/api/calculators/?pageNumber="+String($startPage)+"&pageSize="+String($pageSize)+"&includeDeleted=false"

 ok:=1
 ON ERR CALL("pressero_REST_OnErrorHandler")  // LM: LRJ (Dec 19, 2018  9:27 
PM) 
 $Status:=HTTP Request(HTTP POST 
method;$url;$request;$oResponse;$aHeader_Name;$aHeader_Value)
 ON ERR CALL("")
If (ok=1)
    // process the $oResponse   
End if          

HTH,
Randy

----------------------------------------------------------------------
Randy Jaynes
Senior Programmer and Customer Support

http://printpoint.com • 845.687.3741 • PrintPoint, Inc • 57 Ludlow Lane • 
Palisades, NY 10964 
Please send all email contacts to supp...@printpoint.com






> On Jan 4, 2019, at 3:44 PM, JasonH via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> Trying out Taxjar, but need a little help to get started.
> 
> I'm currently sending the following to https://api.taxjar.com (or
> api.sandbox.taxjar.com)
> $vt_HTTP_Request:=\
> "GET /v2/rates/"+$vt_Zip+<>CRLF+\
> "Host: "+$vt_Service_URL+<>CRLF+\
> "Connection: close"+<>CRLF+\
> "Cache-Control: no-cache"+<>CRLF+\
> "Content-type: text/html; charset=utf-8"+<>CRLF+\
> "Content-length: "+String($vi_Content_Length)+<>CRLF+\
> "Authorization: Bearer "+$vt_API_Key+<>CRLF+<>CRLF+\
> $vt_HTTP_Request
> 
> The actual HTTP request is blank, it's just all header.
> 
> The service is returning:
> {"error":"Unauthorized","detail":"Not authorized for route 'GET
> /v2/rates/98052'","status":401}
> 
> I feel like the zip should be part of the request, but the cURL example has
> it in the address.
> 
> Any ideas what I'm doing wrong?
> 
> 
> 
> --
> Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to