RoadRunnerOz
Programmer
Hi:
I'm trying to send orders to a restful API using VFP7. I have done it before as the first example shows.
Example 1
lcUsername = ALLTRIM(sysfile.User)
lcPassword = ALLTRIM(sysfile.Pass)
lcAsync = .F.
lcFile = "XMLFileCreatedInTempDirectory"
oHTTP = CREATEOBJECT('MSXML2.XMLHTTP')
* - I want product 36073
lcUrl = "
oHTTP.OPEN("GET", m.lcUrl, m.lcAsyn, m.lcUsername, m.lcPassword)
oHTTP.setRequestHeader("Content-Type", "text/xml")
oHTTP.SEND(CREATEBINARY(m.lcFile))
IF "error" $ LOWER(.oHTTP.responseText) OR "we're sorry, but something went wrong" $ LOWER(.oHTTP.responseText)
=MESSAGEBOX("Order: " + m.lcOrderno + CHR(13) + .oHTTP.responseText)
ELSE
=MESSAGEBOX("Order: " + m.lcOrderno + CHR(13) + "Successfully Posted")
ENDIF
STORE .NULL. TO oHTTP
*-- end working code
Example 2
oHTTP = CREATEOBJECT('MSXML2.XMLHTTP')
lcAPIKey = ALLTRIM(sysfile.FFEAPIkey)
lcAsync = .F.
lcUrl = "
oHTTP.OPEN("POST", m.lcUrl, m.lcAsync, m.lcAPIKey)
oHTTP.SEND("")
oHTTP.ResponseText returns:
<?xml version="1.0" encoding="utf-8"?>
<FFEAuthentication>
<Status>Failed</Status>
</FFEAuthentication>
The documentation I got is poorly written, full of grammar/spelling mistakes, incorrect website, sometimes http other times https....
I asked for example code in any language for the various commands and got this for a response:
As for coding your request to the API I cannot help you more than the documentation provided, technically it is exactly the same as a webpage posting the string pairs listed in the API to the endpoint.
There is no mystery. Then the API will return XML
Not very helpful but my guess is he has no idea himself.
This is basically what I have to work with:
FFE Order API uses an http POST request and XML response message and can be run on any platform and in any programming language.
Every API request requires you to authenticate to the API. You will be allocated an API Key that links your business to the system.
Example:
This call is to check that the server is responding and the API key used is correct.
This call is to create an order:
etc...
Any ideas?
I have tried:
oHTTP = CREATEOBJECT('MSXML2.XMLHTTP')
lcAPIKey = ALLTRIM(sysfile.FFEAPIkey)
lcAsync = .F.
lcUrl = "
oHTTP.OPEN("POST", m.lcUrl, m.lcAsync, m.lcAPIKey)
oHTTP.SEND("")
I get OLE IDispatch exception code 0 from msxml3.dll: Access denied
and
lcUrl = "oHTTP.OPEN("POST", m.lcUrl + m.lcAPIKey, m.lcAsync, m.lcAPIKey)
oHTTP.SEND("")
I get OLE IDispatch exception code 0 from msxml3.dll: Access denied
and
lcUrl = " + m.lcAPIKey
oHTTP.OPEN("POST", m.lcUrl )
oHTTP.SEND("")
oHTTP.ResponseText returns:
<?xml version="1.0" encoding="utf-8"?>
<FFEAuthentication>
<Status>Failed</Status>
</FFEAuthentication>
and
oHTTP.OPEN("POST", m.lcUrl, .F. )
oHTTP.SEND("")
oHTTP.ResponseText returns:
<?xml version="1.0" encoding="utf-8"?>
<FFEAuthentication>
<Status>Failed</Status>
</FFEAuthentication>
I release oHTTP and create a new object between calls.
IF I paste + m.lcAPIKey in the command window of Firefox I get an OK
Any ideas?
Thanks in advance
Mick
Michael Ouellette
I'm trying to send orders to a restful API using VFP7. I have done it before as the first example shows.
Example 1
lcUsername = ALLTRIM(sysfile.User)
lcPassword = ALLTRIM(sysfile.Pass)
lcAsync = .F.
lcFile = "XMLFileCreatedInTempDirectory"
oHTTP = CREATEOBJECT('MSXML2.XMLHTTP')
* - I want product 36073
lcUrl = "
oHTTP.OPEN("GET", m.lcUrl, m.lcAsyn, m.lcUsername, m.lcPassword)
oHTTP.setRequestHeader("Content-Type", "text/xml")
oHTTP.SEND(CREATEBINARY(m.lcFile))
IF "error" $ LOWER(.oHTTP.responseText) OR "we're sorry, but something went wrong" $ LOWER(.oHTTP.responseText)
=MESSAGEBOX("Order: " + m.lcOrderno + CHR(13) + .oHTTP.responseText)
ELSE
=MESSAGEBOX("Order: " + m.lcOrderno + CHR(13) + "Successfully Posted")
ENDIF
STORE .NULL. TO oHTTP
*-- end working code
Example 2
oHTTP = CREATEOBJECT('MSXML2.XMLHTTP')
lcAPIKey = ALLTRIM(sysfile.FFEAPIkey)
lcAsync = .F.
lcUrl = "
oHTTP.OPEN("POST", m.lcUrl, m.lcAsync, m.lcAPIKey)
oHTTP.SEND("")
oHTTP.ResponseText returns:
<?xml version="1.0" encoding="utf-8"?>
<FFEAuthentication>
<Status>Failed</Status>
</FFEAuthentication>
The documentation I got is poorly written, full of grammar/spelling mistakes, incorrect website, sometimes http other times https....
I asked for example code in any language for the various commands and got this for a response:
As for coding your request to the API I cannot help you more than the documentation provided, technically it is exactly the same as a webpage posting the string pairs listed in the API to the endpoint.
There is no mystery. Then the API will return XML
Not very helpful but my guess is he has no idea himself.
This is basically what I have to work with:
FFE Order API uses an http POST request and XML response message and can be run on any platform and in any programming language.
Every API request requires you to authenticate to the API. You will be allocated an API Key that links your business to the system.
Example:
This call is to check that the server is responding and the API key used is correct.
This call is to create an order:
etc...
Any ideas?
I have tried:
oHTTP = CREATEOBJECT('MSXML2.XMLHTTP')
lcAPIKey = ALLTRIM(sysfile.FFEAPIkey)
lcAsync = .F.
lcUrl = "
oHTTP.OPEN("POST", m.lcUrl, m.lcAsync, m.lcAPIKey)
oHTTP.SEND("")
I get OLE IDispatch exception code 0 from msxml3.dll: Access denied
and
lcUrl = "oHTTP.OPEN("POST", m.lcUrl + m.lcAPIKey, m.lcAsync, m.lcAPIKey)
oHTTP.SEND("")
I get OLE IDispatch exception code 0 from msxml3.dll: Access denied
and
lcUrl = " + m.lcAPIKey
oHTTP.OPEN("POST", m.lcUrl )
oHTTP.SEND("")
oHTTP.ResponseText returns:
<?xml version="1.0" encoding="utf-8"?>
<FFEAuthentication>
<Status>Failed</Status>
</FFEAuthentication>
and
oHTTP.OPEN("POST", m.lcUrl, .F. )
oHTTP.SEND("")
oHTTP.ResponseText returns:
<?xml version="1.0" encoding="utf-8"?>
<FFEAuthentication>
<Status>Failed</Status>
</FFEAuthentication>
I release oHTTP and create a new object between calls.
IF I paste + m.lcAPIKey in the command window of Firefox I get an OK
Any ideas?
Thanks in advance
Mick
Michael Ouellette