I'm working on connecting to a 3rd-party API (Pipedrive) to a LiveCode app I've done and seem to have a problem; any assistance would be appreciated. Dummy (sandbox) account information has been included with my code sample.

I've never used RESTful before, but the API seems pretty well documented and I've had success much faster than anticipated working with the data in LiveCode. It looks like commands are broke down into 3 types: GET (to retrieve data), POST (to create new data), and PUT (to update existing data).

I can retrieve data using "put URL tRequestURL1 into tJSONfromPipedrive"
I can create new data using "post tJSONtoUpload to url tRequestURL2"
But when I try to update data using "put tJSONtoUpload into url tRequestURL2" I get a 400 error from the server. I tried to urlEncode(tJSONtoUpload) but got the same error.

Their API includes a sandbox for testing, and my code seems to align with their examples and helped me get my tests in order. I'm just not sure what's wrong with my PUT command. https://developers.pipedrive.com/docs/api/v1/#!/Persons/put_persons_id

VARIABLE VALUES:
httpHeaders = {"Accept":"application/json"}
tRequestURL1 = https://api.pipedrive.com/v1/persons?api_token=ef2c59a67144d185277fee92aa9ede877c6c10ff tRequestURL2 = https://api.pipedrive.com/v1/persons/2?api_token=ef2c59a67144d185277fee92aa9ede877c6c10ff
tJSONtoUpload = {"phone":"555-555-5555"}

Is there something glaring I'm missing? I can get this to execute on their developer website, but using the same code seems to error out for me in LiveCode 8.2.0dp2 Business.

--Andrew Bell


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to