mikcanf | Posts: 71

Bulk Send via API -> Unsupported Media Type

0 votes

Hi Duo, I keep getting Unsupported Media type error below:

{"code":415,"messageKey":"http.status.415","message":"Unsupported Media Type","name":"Unsupported Media Type"}


POST {{TheHost}}/api/packages/CsilES9ZX4XpSucsL-s7t3bFQp8=/bulk_send

Content-Type text/csv

BODY-I've tried to put file path/name a few ways, JSON, with quotes, without quotes
raw   Text

{
"FilePath": "C:\Users\mikcanf\Downloads\OneSpan\Commitment letter Data.csv"
}

"C:\Users\mikcanf\Downloads\OneSpan\Commitment letter Data.csv"

C:\Users\mikcanf\Downloads\OneSpan\Commitment letter Data.csv


Duo_Liang | Posts: 3776

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

Hi Mike,

 

Try to make the request Content-Type as "multipart/form-data", add a form data called "file" with the binary of your CSV file.

Accept could be "text/html" - 

A successful response:

<pre>{"id":"d6721790-a0bc-4a54-b24b-25d02e87894d"}</pre>

A failed response:

<pre>[{"messageKey":"error.bulkSend.missingRole","rowNumber":1,"columnName":"BankAccountOwner","roleName":"BankAccountOwner"},{"messageKey":"error.bulkSend.missingRole","rowNumber":1,"columnName":"SalesAgent","roleName":"SalesAgent"},{"messageKey":"error.bulkSend.missingRole","rowNumber":1,"columnName":"Insured","roleName":"Insured"}]</pre>

 

Duo


mikcanf | Posts: 71

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

 

Data

Signer1,FIRST_NAME,LAST_NAME,EMAIL,AUTH_TYPE,AUTH_PROMPT,AUTH_CHALLENGE,SEND_DATE,BUSINESS_NAME,BUSINESS_ADDRESS
Signer1,Signer,Testguy1,[email protected],SMS,+1 xx252,,2020-09-01,This is bus name,This is bus address
Signer1,Signer,Testguy2,[email protected],SMS,+1 xx252,,2020-09-01,This is bus name,This is bus address
Signer1,Signer,Testguy3,[email protected],SMS,+1 xx252,,2020-09-01,This is bus name,This is bus address
 

Error

<pre>[{"messageKey":"error.bulkSend.missingRole","rowNumber":1,
"columnName":"Signer1","roleName":"Signer1"}]</pre>
 

a) Not sure if row1 is header row or 1st row of data

b) above data seems to process Ok inside Sign itself, just not bulk load ???


Duo_Liang | Posts: 3776

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

Hi Mike,

 

The row1 should refer to the header row. From the error message, it seems OSS system can't recognize the first column header "Signer1", which should match the placeholder with role name of "Signer1".

From the CSV content itself, the headers and the data look fine. So to further investigate, do you mind sharing the template ID and this CSV file (with dummy information) that you are uploading?

 

Duo


mikcanf | Posts: 71

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

TemplateId#-> CsilES9ZX4XpSucsL-s7t3bFQp8=

 

Added CEBA commitment letter Data.txt input file.


Attachments
mikcanf | Posts: 71

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

*Note: Template ID# and uploaded file in previous  comment above is from our SANDBOX


Duo_Liang | Posts: 3776

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

Created a template with the same layout at my end, but I didn't reproduce the error when uploading the CSV file(.csv or .txt shouldn't be a matter).

Considering everything looks good to me - CSV headers, placeholder name, label field names, could you try below:

(1)resave the txt or csv file in UTF-8 encoding

(2)try to upload the file through UI, instead of API (at Template tab, expand the three dots after the template line, and choose "Bulk Send transactions")

 

Duo


mikcanf | Posts: 71

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

Hi Duo, I already tried it thru UI and it worked, hence my confusion re API result.  I will load/re-run in UI again.  Per your comments, your use API call worked?


Duo_Liang | Posts: 3776

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

Yes, see my Postman screenshot:
9-2-1

Duo


mikcanf | Posts: 71

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

UI works, not API, for some reason.  What version of POSTMAN are you using?  What version of Sign are you using?


Duo_Liang | Posts: 3776

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

My Postman is 7.31.0. I also found that if you choose the form data "file" as text type, and insert the content in plain text, should also work. For OneSpan Sign instance, it's the same CA sandbox as your account.

 

Duo


mikcanf | Posts: 71

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

Hi Duo, success! after I copied your screen it worked!   Thx for all your help!


Duo_Liang | Posts: 3776

Reply to: Bulk Send via API -> Unsupported Media Type

0 votes

Glad it works for you!


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off