Re: Cómo crear un API?
Posted: Mon Aug 06, 2018 11:59 pm
Si alcanza aca te envio mi solicitud... joseluisysturiz@yahoo.com saludos, gracias...
www.FiveTechSoft.com
https://forums.fivetechsupport.com/
Code: Select all | Expand
#include "fivewin.ch"
Function APIS(cOpe)
local doc,oHttp,cText,cText1,response,cStr,hHash,nLen,r
default cOpe:='VU'
doc:=CreateObject( "MSXML2.DOMDocument" )
oHttp:=CreateObject( "MSXML2.XMLHTTP" )
if cOpe=='VU'
oHttp:Open( "POST" ,"http://www.answerspip.com:80/apidms/v1/Venta",.F.)
endif
oHttp:SetRequestHeader("cache-control", "no-cache")
oHttp:SetRequestHeader("content-type", "application/json" )
oHttp:SetRequestHeader("authorization", "Token token=398336e2a7bbeaac6d3858c1551a8536" )
if cOpe=='VU'
cText:=MemoRead("p:\tmp\ventauni.json")
endif
TRY
oHttp:Send( cText )
? cText
CATCH
msginfo("No Se Pudo Enviar Documento JSON","Intente Nuevamente")
return .t.
END
response:=oHttp:responseText
if cOpe=='VU'
MemoWrit( 'p:\tmp\SendVentaUni_Res.json',response)
cText1:=MEMOREAD("p:\tmp\SendVentaUni_Res.json")
endif
?cText1 // ver respuesta del servidor .
return NIL