RESTful PUT error

Sean Cole (Pi) sean at pidigital.co.uk
Fri Dec 15 20:27:12 EST 2017


Hi Andrew,

I've been doing a whole heap of this just recently so have gained more
experience in this than I would have hoped for :(  In other words, I had
hoped it would have been easier. especially working with oAuth procedures
which ended up as a rolling nightmare for me these last few weeks. Here's
what I notice first off. And not wanting to jump to any conclusions, I have
checked the PipeDrive site too. (I'm working on a library for the new Adobe
Sign API using oAuth which I am converting from the previous SOAP method we
used to use)

Their API, under Request Format states:

 In order to do a proper JSON-formatted request, make sure you provide
Content-Type:
> application/json as part of your HTTP request.

So your header would require this also. Ordinarily, it would be recommended
to put your access token in your header too for security reasons (even if
it IS via https). But, they require you add it as a query in your uri. So
you should now have something like:

Put "{'phone':'555-555-5555'}" into tJSON

replace "'" with quote in tJSON

Put "https://api.pipedrive.com/v1/persons/1?api_token=" & tToken into tURL

Set the httpheaders to "Content-Type: application/json" &lf& "Accept:
application/json"

Post tJSON to tURL


So, really it's only this Content-Type that's holding you back as otherwise
it is wondering what you are sending it and you have to be explicit.

That's it really. The only characters that tend to cause me trouble are
misplaced quotes, hashes, pound sign (£), slashes and new lines. But these
you either provide ascii alternatives or backslash escape them. But you
have used everything appropriately. It just doesn't recognise you've sent
it any JSON formatted content.

All the best.

Sean Cole
*Pi Digital Productions Ltd*


On 15 December 2017 at 17:19, Andrew Bell via use-livecode <
use-livecode at lists.runrev.com> wrote:

> I tried suggestions from several users (on and off the list), but nothing
> has worked for me. After contacting Pipedrive tech support, I got the
> typical IT response of "it works for us" as they blamed LiveCode. They
> suggested that somehow using regex would fix the issue, but I'm not sure
> how that would even apply here (their API is telling me the characters are
> disallowed, not LC). Using tsNet calls gave me the same errors as libURL
> from LC (8.2dp2 and 9.0dp10).
>
> httpHeaders: {"Accept":"application/json"}
> JSON being POSTed (not PUT as their API requests): {"phone":"555-555-5555"}
> URL being POSTed to (includes my API key for a test account):
> https://api.pipedrive.com/v1/persons/1?api_token=ce95ed7f11e
> 167194b0b4a6f6f1032df4fa13792
>
> Reply from their support team:
> I checked with our engineers regarding the "Disallowed Key Characters"
> message, and they believe this is related to your code editor of choice.
> Some additional programming may be necessary to include these "disallowed"
> characters. They also tested updating the phone value themselves via API,
> and were successful.
>
> For more reference on this issue, they also recommend the following
> resources:
> https://stackoverflow.com/questions/4197976/codeigniter-disa
> llowed-key-characters
> http://www.darwinbiler.com/disallowed-key-characters-in-codeigniter/
>
>
> --Andrew Bell
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the Use-livecode mailing list