wendyguo | Posts: 74

Override $PACKAGE_OWNER_EMAIL via API SDK

0 votes

Is it possible to override $PACKAGE_OWNER_EMAIL when createPackage via API SDK?


Duo_Liang | Posts: 3776

Reply to: Override $PACKAGE_OWNER_EMAIL via API SDK

0 votes

Hi Wendy,

 

The "$PACKAGE_OWNER_EMAIL;" parameter always points to the package owner, therefore the only way to change the value is to let the desired sender created the package, and in turn, become package owner. You can either use the sender's API Key instead of account owner's or use the feature "Send on behalf of a Sender" which allows you to use account owner's API Key and create package under respective sender.

 

With Java SDK:
DocumentPackage pkg1 = PackageBuilder.newPackageNamed("Create on behalf of " + System.currentTimeMillis())
        .withSigner(SignerBuilder.newSignerWithEmail("[email protected]" )
                .withFirstName("John")
                .withLastName("Smith"))
        .withDocument(DocumentBuilder.newDocumentWithName("document 1")
                .fromFile("your_file_path")
                .withSignature(SignatureBuilder.signatureFor("[email protected]")
                        .onPage(0)
                        .atPosition(100, 100)
                        .withSize(250, 75)))
        .withSenderInfo(SenderInfoBuilder.newSenderInfo("[email protected]"))
        .build();

 

 

With REST API:

{                                                                                               
    "status": "DRAFT",                                                                      
    "description": "Test package'",                   
    "language": "en",                                                                       
    "type": "PACKAGE",                                                                     
    "visibility":"ACCOUNT",                                                                 
    "name": "Send On Behalf Of A Sender",                                                   
    "sender": {                                                                               
        "email": "[email protected]"                                                       
    }  
                                                                                        
}  
 

Above, the .withSenderInfo() function and the "sender" node in JSON is where you specify the sender's email.

 

Duo


wendyguo | Posts: 74

Reply to:

0 votes

Hi Duo,

 

Thanks for your information. But after I added this line:  .withSenderInfo(SenderInfoBuilder.newSenderInfo("[email protected]")), I got the below error when createPackage

 

{
    "source" : "ESignLive",
    "errors" : [
        {
            "errorKey" : "escs.error.failed.createPackage",
            "errorMessage" : "Create Package failed. E-SignLive Error: Could not create a new package in one-step Exception: HTTP POST on URI https://sit.ssaa.cibc.com:8024/api/packages resulted in response with status code: [403, Forbidden]. Optional details: {\"code\":403,\"messageKey\":\"error.forbidden.accountNotAccessible\",\"message\":\"The operation requested cannot be done by the user requesting it because there is an account access mismatch\",\"name\":\"Access Denied\"}"
        }
    ]
}

Before Add this line, I can successfully create package. Any idea what is wrong?


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