03-03-2016, 09:10 PM
Looking for a clue here ... I'm trying duplicate the curl command below with CML. It kinda works, but the Data isn't getting passed. I have a feeling I'm using the SendPost method incorrectly. Any thoughts?
Code:
curl -X POST -H "Content-Type: application/json" -d '{"value1":"a","value2":"b","value3":"c"}' https://maker.ifttt.com/trigger/cqc_notify/with/key/cf_8ZeO4rVrss2VmyFty4f
Method runMe([Out] String RetCode) Returns Int4 Begin
Locals=
LinesList OutHdrLines;
LinesList InHdrLines;
LinesList PostVals;
URL URLobject;
String RepText;
String ContType;
MemBuf DataBuf;
Card4 ContLen;
Card4 ResCode;
String URLStr;
String Data;
EndLocals;
Data := "{\"value1\":\"a\",\"value2\":\"b\",\"value3\":\"c\"}";
URLStr := "https://maker.ifttt.com/trigger/cqc_notify/with/key/dfg43fg34";
ContType := "application/json";
m_XCoder.ConvertTo(Data, DataBuf, ContLen);
Try
URLobject.Set(URLStr, FQTypes.Full);
//ContLen := 0;
ResCode := m_HTTP.SendPOST(URLobject, 5000, "myAgent", "*/*", PostVals
, RepText, OutHdrLines, ContType, DataBuf, ContLen
, InHdrLines);
RetCode.Clear();
RetCode.AppendCard4(ResCode, Radices.Dec);
EndTry;
Catch
Return 0;
EndCatch;
Return 1;
EndMethod;
--Kill all the serial ports--