1 of 1 people found this helpful
- Content-Type is an HTTP header, not a parameter
- the path is /bulk/v1/leads.json, not /rest/bulk/v1/leads.json
- you shouldn't be faced with creating a muiltipart/form-data payload on your own; even in Postman, the form-data type does this for you
Thanks Sanford! Silly errors
I'm now getting a response (great) but it seems I'm still missing a small piece of the puzzle. Here's what I have now:
Content-Type: multipart/form-data; boundary=--------------------------WebKitFormBoundaryBQACkJZyaiIAXogC
form-data: agent_clusters (with file selected)
Content-Disposition: form-data; name="file"; filename="agent_clusters.csv"
And I'm getting this error:
"message": "Missing value for required parameter 'file'"
I've also tried adding "file" as a parameter, using "agent_clusters.csv" "agent_clusters" and even the URL of where I have uploaded the csv, and none of these change the error I'm getting. Why?
Additionally, one thing I don't understand is why I am putting some of the csv output in the "raw" body of the request despite the fact I'm uploading a csv with all the values.
Your boundary header isn't reflecting the actual content of the payload.
If the boundary header is
then the payload must have
Aha! Got it!
It turns out I had a couple of things wrong:
1. As you mentioned, when you specify "form-data" type in the body of the Postman call, you don't need the header at all - Postman assumes it.
2. My csv was saved as UTF-8, which means there was some weird encoding.
So it's actually a lot simpler than I thought. I just needed those three parameters (access token, lookupField of ID, and format of csv), then specify "form-data" in the body, and attach the file to a "file" key.