pardot / api-docs

29 stars 30 forks source link

Issue with v5 Documentation for Prospect Create #234

Closed davidhjones closed 2 years ago

davidhjones commented 2 years ago

The v5 documentation suggests that the HTTP Method POST is supported to create a Prospect, yet requests to this API result in a 405 Method Not Allowed response status code.

Example request:

POST https://pi.demo.pardot.com/api/v5/objects/prospects HTTP/1.1
Host: pi.demo.pardot.com
Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Pardot-Business-Unit-Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Cookie: pardot=mmhfmul710rfh7je6jt5j52r17
Content-Type: application/json; charset=utf-8
Content-Length: 32

{"email":"sample@gmail.com"}

Example response:

HTTP/1.1 405 Method Not Allowed
date: Wed, 26 Jan 2022 22:05:59 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
cache-control: no-store, no-cache, must-revalidate
pragma: no-cache
x-pardot-rsp: 0/0/1
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding,User-Agent
content-length: 51
content-type: application/json
X-Pardot-Route: 6ce930eaa2a6f6d8763617e4a9f6a495
Server: PardotServer
X-Pardot-LB: 81ef3179da45557cd28f9ba13d8805bd

{"code":60,"message":"Invalid HTTP request method"}

Is this expected behavior?

adelawalla commented 2 years ago

@davidhjones Sorry for the confusion, these new APIs will go live as part of the Winter '22 release on Feb 14. We release the docs ahead of the features so developers can get a look at what's to come, but unfortunately the docs don't reference the actual release date. It does appear that you're doing everything correctly. We'd love to hear back from you if everything goes as expected once the features go live.

davidhjones commented 2 years ago

Thanks for the update @adelawalla! The v5 version feels a lot more natural compared with other APIs I'm familiar with, so at a glace I like the new version. I've only looked into the Prospect API though.

I'll take a look at using the v4 version for now, since I have an immediate need to build a solution, with plans to transition to the v5 API when available. @adelawalla is Feb 14th a hard release date?

davidhjones commented 2 years ago

@adelawalla can you provide any assistance with the v4 API? The create request keeps returning 400 bad request, yet I've formatted it exactly like the documentation:

Request

POST https://pi.demo.pardot.com/api/prospect/version/4/do/create?format=json HTTP/1.1
Authorization: Bearer yyyyyyyyyyyyyyyyyyyyyyyyyy
Pardot-Business-Unit-Id: yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Content-Type: application/json
User-Agent: PostmanRuntime/7.28.4
Accept: */*
Cache-Control: no-cache
Postman-Token: f94b2b9e-6d6f-42fc-91b3-7094319227f5
Host: pi.demo.pardot.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 61
Cookie: pardot=6ibtele1qqrcn2mkod4f2hplgf

email=kmandair@sample.com&first_name=Kulvir&last_name=Mandair

Response

HTTP/1.1 400 Bad Request
date: Thu, 27 Jan 2022 18:25:16 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
cache-control: no-store, no-cache, must-revalidate
pragma: no-cache
x-pardot-rsp: 0/0/1
strict-transport-security: max-age=31536000; includeSubDomains
content-encoding: gzip
vary: Accept-Encoding,User-Agent
content-length: 104
content-type: application/json
X-Pardot-Route: 6ce930eaa2a6f6d8763617e4a9f6a495
Server: PardotServer
X-Pardot-LB: 81ef3179da45557cd28f9ba13d8805bd

{
    "@attributes": {
        "stat": "fail",
        "version": 1,
        "err_code": 4
    },
    "err": "Invalid prospect email address"
}
davidhjones commented 2 years ago

I figured it out by inferring at the other v4 API endpoints. I was passing in the body as json instead of x-www-form-urlencoded

adelawalla commented 2 years ago

@davidhjones Sorry for the late response. We typically stagger the rollout a bit, so you should receive it within 24-48 hours of the release date. Glad to hear v5 feels more natural! It's been one of our big goals to make it feel more standardized.