cjariscdk | Posts: 15

Apex SDK - Receiving Error "message":"Invalid parameters.","code":400,"name":"Validation Error"

0 votes

We were successfully sending transactions and documents to OneSpan until the start of this week when we started receiving the below error. I have also put the invoking code below, it is based on the Apex SDK. It's a weird error as this was working on Friday..

CallOut:

HttpRequest[

Endpoint=https://sandbox.esignlive.com/api/packages/2c-NU-6SlNqyIhDT2Uhew9hueus=/documents, Method=POST

]

Error in Full Text:
OneSpanRESTAPIHelper.OneSpanRestAPIHelperException: Error creating OneSpan package with documents: 400 - Bad Request - {"technical":"Unexpected Content-Disposition value for parameter 'name'","messageKey":"error.validation.invalidParameters","message":"Invalid parameters.","code":400,"name":"Validation Error"}

Invoking Code:

OneSpanSDK sdk = new OneSpanSDK();
        
OneSpanAPIObjects.Package_x pkg = new OneSpanAPIObjects.Package_x();
pkg.name = 'Test Subject ' + DateTime.Now();
String packageId = sdk.createPackage(pkg);
Cust_Object__c dsRec = [SELECT Id FROM Cust_Object__c WHERE Id = :dsId LIMIT 1];// Gets the document
// Create Documents for Transaction
Attachment att = [Select Id, Name, Body, ParentId From Attachment Where ParentId = :dsId];
Map<String,Blob> doc = new Map<String,Blob>();
doc.put('Sample Document', att.Body);
        
OneSpanAPIObjects.Document document = new OneSpanAPIObjects.Document();
document.name = att.Name;
document.id = 'document1';
String resp = sdk.createDocuments(packageId, document, doc);


Approved Answer
Duo_Liang | Posts: 3776

Reply to: Apex SDK - Receiving Error "message":"Invalid parameters.","code":400,"name":"Validation Error"

0 votes

Hi Charles,

 

I've seen the same error in a few recent cases(case1, case2) when using APEX sdk function sdk.createDocuments(packageId, document, doc);

A quick question, what's the file type of your attachment body? It might the cause of issue if it's not a PDF file when you use .createDocuments() method.

 

Duo


cjariscdk | Posts: 15

Reply to: Apex SDK - Receiving Error "message":"Invalid parameters.","code":400,"name":"Validation Error"

0 votes

Hi Duo,

 

We were using a .docx file, but when I converted it to a pdf and re-attached it, that appears to have solved it! 

Thank you so much for your assistance!


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