I can send GET commands without a problem, but POST commands keep returning errors.
Here is my cURL command, which works (obviously the XXXs gave a real value):
Code: Select all
curl \
-H application-id:XXXXXXXXXXXXXX \
-H secret-key:XXXXXXXXXXXXXX \
-H Content-Type:application/json \
-H application-type:REST \
-X POST \
-v 'http://help.mad.pink/api/v1/users/register' \
-d '{"email":"greg@vadin.com", "name":"Greg", "password":"1234567890"}'
Code: Select all
{"userStatus":"ENABLED","created":1458998553000,"name":"Greg","ownerId":null,"updated":null,"email":"greg@vadin.com","objectId":"B32803F2-30E2-5333-FF0E-089885EC6B00","__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"password\",\"created\",\"___saved\",\"name\",\"___class\",\"ownerId\",\"updated\",\"email\",\"objectId\"],\"relatedObjects\":{}}"}
Code: Select all
function userReg
put "application-id:XXXXXXXXXXXXXX " & cr into tHeaders
put "secret-key:XXXXXXXXXXXXXX " & cr after tHeaders
put "Content-Type:application/json" &cr after tHeaders
put "application-type: REST" after tHeaders
set httpHeaders to tHeaders
put "http://help.mad.pink/api/v1/users/register" into regURL
put "{qqemailqq:qqgreg@vadin.comqq, qqnameqq:qqGregqq, qqpasswordqq:qq1234567890qq}" into tDATA
replace "qq" with quote in tDATA
post tDATA to URL regURL
return the result
end userReg
Code: Select all
error 400 Bad Request