Disallowed Key Characters, also with Content-Type = application/json

Hello Developers,

I’m trying to realize a connection with the Pipedrive API,
for which I generated a Java-client using the swagger-codegen-maven-plugin on the OpenApi yaml specification (after I cleaned it up a little).
However, when I now try to create a person or organization from that client, I do get the error response “Disallowed Key Characters” (just like reported in Response: Disallowed Key Characters)
However, in my case, the content-type parameter was set to JSON (application/json to be exact).

To show some more details, I attached a screenshot of the debugger window.

I can perform searches, so my authentication works apparently.

Could you give me any clue on what could be wrong here?

Somehow, from postman tests, it appears that the content-type should be set to application/x-www-url-encoded.
I wonder if this is specified somewhere…

1 Like

Hi @holandamario,
Thanks for identifying the issue and for sharing it with the community. You can find the headers preset in the POSTMAN collections over here Pipedrive API in Postman or Insomnia

However, it is interesting that the request fails with the JSON content type. If possible, can you share the logs & correlation ID in the API response ?

Thanks :slight_smile:

Hello @Hem,
Sure, I just performed another test a few minutes ago… using content-type multipart/form-data (it turns out to work too).
The test was succesful, in the response headers I found:
x-correlation-id: a12881b6-c1a7-4764-891a-b4085630cb57

For the sake of completeness, I’ll do another test with application/json content-type…
And indeed, it fails again.
The correlation-id is now: 906dae56-1ec3-4437-bbf5-18e44fd1fbdd
The error-message returned is: Illegal key in payload!

I’m not sure where to find the logs…
Hope to hear from you soon!

That is interesting. The illegal key in payload hints that something is off when the payload is constructed. Can you share the payload structure before it is sent? (The JSON representation of it)

Sure, how about this one!?
{“name”:“BillingHouse”,“visible_to”:“3”,"":“AddOrganizationRequest”}

Ahh yes, and when I don’t quote the 3 like this:
{“name”:“BillingHouse”,“visible_to”:3,"":“AddOrganizationRequest”},the request fails too, but with message
Disallowed Key Characters.

hey @holandamario,

I guess the problem is due to the payload structure. Instead of

{“name”:“BillingHouse”,“visible_to”:“3”,"":“AddOrganizationRequest”}

can you try to structure the payload without the last property?

it should only be

{"name":"BillingHouse","visible_to":3}

Thanks @Hem… that seems to work indeed…
Here is the explanation why I didn’t try that immediately:

Anyway, I’ll try to find the minimum required changes to get this empty key out
of the JSON and let you know…

1 Like