Skip to main content
Level 2
Mar 16, 2023 6:57 AM UTC
Question

Submit delivery via API using classic JS SDK

Hi can anyone tell what i am doing wrong :

I am trying to submit delivery by usingadobe campaign classic  SDK

code for that:

 

 

const sdk = require('@adobe/acc-js-sdk');

(async () => {
// Display the SDK version
const version = sdk.getSDKVersion();
console.log(`${version.description} version ${version.version}`);

// Logon to a Campaign instance with user and password
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("url",
"username", "password");
const client = await sdk.init(connectionParameters);
await client.logon();
const NLWS = client.NLWS;
 
const xml = `<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:xtk:session'>
<soapenv:Header/>
<soapenv:Body>
<urn:SubmitDelivery>
<urn:sessiontoken>___33ddebcc-4b54-4698-9819-2700d90ae8cd</urn:sessiontoken>
<urn:strScenarioName>DM1882</urn:strScenarioName>
<urn:elemContent>
<delivery xtkschema="nms:delivery">
<scheduling validationMode="auto" />
<targets >
<deliveryTarget>
<targetPart>
<where filteringSchema="nms:recipient">
<condition expr="@email = 'arnav.kumar+1@gmail.com'"/>
</where>
</targetPart>
</deliveryTarget>
</targets >
</delivery>
</urn:elemContent>
</urn:SubmitDelivery>
</soapenv:Body>
</soapenv:Envelope>`;


const deliveryId = await client.nms.delivery.SubmitDelivery("DM1882",xml);

console.log(deliveryId);
})().catch((error) => {
console.log(error);
});
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Manoj_Kumar
Community Advisor
Community Advisor
Mar 16, 2023 11:09 PM UTC

Hello @arnav21 

 

Can you please share more details, like what error you are getting while executing this code?

Translate
Manoj  | https://themartech.pro
akshaaga
Adobe Employee
Adobe Employee
Mar 21, 2023 8:01 AM UTC

Hi @arnav21 ,

It's not clear what the issue is that you're experiencing. Can you please provide more information about the problem you're encountering? Are you seeing any error messages, or is the code not behaving as expected?

Also, it's important to note that it's not recommended to share your username and password in public forums for security reasons. It's better to use environment variables or configuration files to store these sensitive credentials.

Translate
Sukrity_Wadhwa
Level 4
Apr 19, 2023 8:34 AM UTC

Hi @arnav21,

Were you able to resolve this query on your own or do you still need help here? If you do, then kindly share more details as requested above by @akshaaga & @_manoj_kumar_.

Thanks!

Translate
Sukrity Wadhwa