I'm off on yet another Web API connection for another vendor and of course more frustration for something that should be dirt simple. This is a simple GET statement using Basic authentication that doesn't work with Curl but does work in Postman - I get a correct return. Don't try it, I've changed most of the bits to protect the innocent. Curl throws an error about the port not being specified but since it works in Postman I don't care.
Code:
curl -v -u MyUserID:MyPassword -H "Content-Type: application/json" -X GET 'https://VendorURL.freshdesk.com/api/v2/tickets'
Since it works in Postman, I wrote a small DF program to try and get this to work in DF but no joy.
Code:
Class cHttpTransferWinRest is a cHttpTransfer
Function MakeTheCall
Integer iOK
String sAuth sBody
Handle hoBody
Move ("MyUserID" + ":" + "MyPassword") to sAuth
Send Reset
Get AddHeader "Content-Type" "application/json" to iOK
Get AddHeadder "Accept" "*/*" to iOK
Get AddHeader "Authorization" ("Basic " + (Base64Encode(AddressOf(sAuth), Length(sAuth)))) to iOK
Get Stringify of hoBody to sBody
Get HttpVerbAddrRequest sPath (AddressOf(sBody)) (Length(sBody)) False sVerb to iOK
If iOK Begin...
End_Function
End_Class
And I've tried many variations on the above code with no success. I think I understand basic authentication and in this case there is no body so it's blank.
Hopefully there's some simple syntax thing that I'm missing but what is it?
TIA...