pardot / api-docs

29 stars 30 forks source link

batchUpdate error Input needs to be valid JSON or XML #232

Closed vbastos closed 4 years ago

vbastos commented 4 years ago

The batchUpdate endpoint does not seem to work. I have tried several different variations in vain.

1 --------------------- POST /api/prospect/version/4/do/batchUpdate HTTP/1.1 pardot-business-unit-id: Authorization: Bearer Content-Type: text/plain User-Agent: PostmanRuntime/7.26.5 Accept: / Host: pi.pardot.com Accept-Encoding: gzip, deflate, br Connection: keep-alive Content-Length: 370 Cookie: pardot=0a69djfk24re9qhn8r7d4i73tc {"format":"json","prospects":[{"action_history":"","email_address":"test@test.com","id":80570746,"op_ID":"1","products_activated":"","products_downloaded":""},{"action_history":"","email_address":"test2@test.com","id":76910002,"op_ID":"2","products_activated":"","products_downloaded":""}]} HTTP/1.0 400 Bad Request Date: Wed, 16 Sep 2020 04:45:42 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache X-Pardot-Rsp: 16/24/48 P3p: CP="NOI DSP COR CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT", policyref="/w3c/p3p.xml" Vary: Accept-Encoding,User-Agent Content-Encoding: gzip Content-Length: 142 Content-Type: text/xml; charset=utf-8 X-Pardot-Route: 4fa993bd92d83a19a78f84f1ddd264ce Server: PardotServer X-Pardot-LB: 7044ba9c794aba658bc1be2f8b8ad85c Connection: keep-alive <?xml version="1.0" encoding="UTF-8"?>

access_token is invalid, unknown, or malformed

2 ------------------

POST /api/prospect/version/4/do/batchUpdate?prospects=[{%22action_history%22:%22%22,%22email_address%22:%22test@test.com%22,%22id%22:80570746,%22op_ID%22:%225f5f2e36e0145e6a1f1136e1%22,%22products_activated%22:%22%22,%22products_downloaded%22:%22%22},{%22action_history%22:%22%22,%22email_address%22:%22test@test.net%22,%22id%22:76910002,%22op_ID%22:%225f5f2e36e0145e6a1f1136e2%22,%22products_activated%22:%22%22,%22products_downloaded%22:%22%22}] HTTP/1.1 pardot-business-unit-id: Authorization: Bearer User-Agent: PostmanRuntime/7.26.5 Accept: / Postman-Token: d04a8e2a-1973-4874-8310-4d5ae6a95d30 Host: pi.pardot.com Accept-Encoding: gzip, deflate, br Connection: keep-alive Cookie: pardot=0a69djfk24re9qhn8r7d4i73tc Content-Length: 0 HTTP/1.0 400 Bad Request Date: Wed, 16 Sep 2020 04:48:36 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache X-Pardot-Rsp: 16/50/81 P3p: CP="NOI DSP COR CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT", policyref="/w3c/p3p.xml" Content-Encoding: gzip Vary: Accept-Encoding,User-Agent Content-Length: 136 Content-Type: text/xml; charset=utf-8 X-Pardot-Route: 4fa993bd92d83a19a78f84f1ddd264ce Server: PardotServer X-Pardot-LB: a5df88223e39cf9fcb783877fed82f24 Connection: keep-alive <?xml version="1.0" encoding="UTF-8"?>

Input needs to be valid JSON or XML
vbastos commented 4 years ago

It seems there is technically no issue aside from the fact that this api is a little strange and the documentation needs to be improved.

It turns out the the expect from data is actually prospects={"prospects". So the variable name prospects is actually set twice. So far I was only able to make a valid query using the query parameter method.

/api/prospect/version/4/do/batchUpdateformat=json&prospects={"prospects":[{"id": ...}]