SOLVED

Postman bulk import of leads - no response?

Go to solution
Phillip_Wild
Level 10

Postman bulk import of leads - no response?

Hi everyone

I'm trying to bulk update some leads. I have a csv file with Marketo ID in one column, and the field value I'd like to update in the other.

I'm using Postman to try and create the job using this documentation: http://developers.marketo.com/rest-api/bulk-import/

Here is what I'm trying to do in Postman:

https://REDACTED.mktorest.com/rest/bulk/v1/leads.json?format=csv&access_token=REDACTED&content-type=...

(I read that the boundary field is sort of arbitrary - you can call it what you like)

My raw body:

--boundary

Content-Disposition: form-data; name="file"; filename="agent_clusters.csv"

id,agentCluster

515309,NGJ

--boundary--

And form-data:

agent_clusters, and the file I uploaded next to that in the Postman interface.

So when I do this, I get....absolutely nothing. Zero. No response at all, at least in the regular spot in Postman. Which of course, makes this quite difficult to troubleshoot! Any ideas? When I make the file bigger than 1mb I get a "file size exceeded" error, but other than that I can't get any response output at all.

2 ACCEPTED SOLUTIONS

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Postman bulk import of leads - no response?

  • 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

View solution in original post

SanfordWhiteman
Level 10 - Community Moderator

Re: Postman bulk import of leads - no response?

Your boundary header isn't reflecting the actual content of the payload.

If the boundary header is

  --something

then the payload must have

  ----something

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Postman bulk import of leads - no response?

  • 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
Phillip_Wild
Level 10

Re: Postman bulk import of leads - no response?

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:

Parameters:

format:csv

access_token:REDACTED

lookupField:id

Headers:

Content-Type: multipart/form-data; boundary=--------------------------WebKitFormBoundaryBQACkJZyaiIAXogC

Body:

form-data: agent_clusters (with file selected)

raw:

------WebKitFormBoundaryBQACkJZyaiIAXogC

Content-Disposition: form-data; name="file"; filename="agent_clusters.csv"

id,agentCluster

513191,Classic

513220,Classic

513238,Active

513252,Classic

------WebKitFormBoundaryBQACkJZyaiIAXogC--

And I'm getting this error:

{

    "requestId": "1867b#16484baabbf",

    "success": false,

    "errors": [

        {

            "code": "1002",

            "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.

Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Re: Postman bulk import of leads - no response?

Your boundary header isn't reflecting the actual content of the payload.

If the boundary header is

  --something

then the payload must have

  ----something

Phillip_Wild
Level 10

Re: Postman bulk import of leads - no response?

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.

Thanks Sanford!

Tags (1)
Jiten_Savla
Level 1

Re: Postman bulk import of leads - no response?

Hello @Phillip_Wild , please help me understand this.

I've a CSV file with three headers and sample values.
CompanyGUID,CompanyName,CompanyNameAKA
'GUID123', 'CompanyName', 'AKACompany'

And i don't understand why i keep getting the error,

{
    "requestId""14971#17014203bb0",
    "success"false,
    "errors": [
        {
            "code""1006",
            "message""Header field 'CompanyGUID' not found"
        },
        {
            "code""1006",
            "message""Header field 'CompanyName' not found"
        },
        {
            "code""1006",
            "message""Header field 'CompanyNameAKA' not found"
        }
    ]
}
Phillip_Wild
Level 10

Re: Postman bulk import of leads - no response?

Hi Jiten

 

Which bulk endpoint are you trying to hit? Based on your info below, it looks like you are trying to update Company details via the bulk API. I don't believe that's possible - in my example, I was updating Marketo-only fields based on the Marketo Person ID.