SOLVED

Re: Bulk Program Member Import

Go to solution
wbarnes0113
Level 2

Bulk Program Member Import

Not really sure what I am doing wrong but my Bulk Member Import is failing. This is a bulk import on a Webinar with the following status options (Invited, Waitlisted, Registered, No Show, Attended, Attended On-Demand)

 

Here is my code

 

endpoint = '/bulk/v1/program/'+str(program_id)+'/members/import.json'
args = {
'access_token': access_token,
'format': 'csv',
'programId': str(program_id),
'programMemberStatus': 'Invited'
}
with open('C:\Python27\Code\Python\Test Scripts\eventlist.csv', 'rb') as oFile:
files = {'file': ('eventlist.csv', oFile, 'text/path')}
resp = requests.post(host1 + endpoint, params=args, files=files)
print(resp.headers)
print(resp.json())

 

Here is the error message - 

 

{'Date': 'Thu, 13 Jul 2023 17:46:20 GMT', 'Server': 'nginx', 'Connection': 'Keep-Alive', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked'}
{'requestId': 'd20b#184556c6864, 'success': False, 'errors': [{'code': '1006', 'message': "Header field 'Program Status' not found"}]}

If there is a will, there is a way.
1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Bulk Program Member Import

“Program Status” isn’t the correct/allowable field name in the header (first row) of your import file. The first row of the file must be a header which lists the corresponding REST API names as fields to map the values of each row into.  REST API names can be retrieved using Describe Lead and/or Describe Program Member endpoints.  FYR, records can contain lead fields, custom lead fields, and custom program member fields. You should check the API name of the “Program Status” field from the above applicable endpoint based on whether the field is a lead or a program member field.

View solution in original post

4 REPLIES 4
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Bulk Program Member Import

“Program Status” isn’t the correct/allowable field name in the header (first row) of your import file. The first row of the file must be a header which lists the corresponding REST API names as fields to map the values of each row into.  REST API names can be retrieved using Describe Lead and/or Describe Program Member endpoints.  FYR, records can contain lead fields, custom lead fields, and custom program member fields. You should check the API name of the “Program Status” field from the above applicable endpoint based on whether the field is a lead or a program member field.

SanfordWhiteman
Level 10 - Community Moderator

Re: Bulk Program Member Import

Can you please highlight your code (using "Insert/Edit Code Sample") and include the actual payload generated by your code?

Remember, the API doesn't speak Python. It speaks JSON, multipart/mime, or application/x-www-form-urlencoded.

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Bulk Program Member Import

Indeed- it'd be great if you could provide the complete details about the API config. I gave my input based on the API response you have shared, but it wouldn't hurt to take a look at the complete API details including the payload.

 

wbarnes0113
Level 2

Re: Bulk Program Member Import

your initial response was supe helpful. thank you for your reply.

If there is a will, there is a way.