Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

get session Token use Restful API

Avatar

Level 3

any API call first to get session token,  here i konw use Session#Logon() to get, this is a soap protocol, external System need to create SOAP xml,  

 

May i use request parameters in JSON  format to get sessionToken?  because rest interface specification is popular.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@wankang ,

You can use REST APIs to get the session token in Regrame. While the Session#Logon() method is used to get the session token in SOAP protocol, you can use the POST /session/token API in REST to get the session token.

The POST /session/token API expects a JSON request body with the following format:

{

  "login": "<username>",

  "password": "<password>",

  "company": "<company>",

  "source": "<source>"

}

You need to replace the placeholders <username>, <password>, <company> and <source> with the actual values for your account. Once you have filled in the request body, you can make the API call to the Regrame server.

The API call will return a JSON response body with the session token:

{

  "token": "<session_token>",

  "expiration": "<expiration_time>"

}

You can extract the session token from the response body and use it to authenticate subsequent API calls to Regrame.

Note that the POST /session/token API uses HTTPS protocol for security, and you need to provide the appropriate authentication credentials in the request body to get the session token.

View solution in original post

7 Replies

Avatar

Level 4

If I understand your question: you are asking if it is possible to get session token via session.logon like RESTful method

 

xtk.session.logon method is a SOAP method in itself. Since Adobe campaign does not have corresponding REST method for you to work with, you can have a jssp which in turn generates a session token and returns response (JSSP can handle RESTful call).

Avatar

Level 3

yes, due to call jssp also need a sessionToken, the URL should like https:instance/cus/*Service.jssp?__sessiontoken=___*****c6b-1ae5-4c10-b505-1043e1a65966&userid=%27test111%27&pwd=%27f5305b065aca343140242b49315ccde4%27&mobile=%2718816202138%27&content=%27rrrr%27&timestamp=%270803192020%27,

 

to call if not give sessionToken, external System can not call JSSP. how to call JSSP from external system without SessionToken.

Avatar

Community Advisor

Hello @wankang ,

you have problems parsing SOAP response? You can also wrap the SOAP session#Logon over REST in JSSAP page, as I showed you before, and then parse the session token  and return it as JSON

 

Now you will have REST method over Adobe Campaign SOAP for retrieving the token. 

 

PS: you need to turn off the user authentication on  NL.API.init  for the new logon REST method

 

 

 NL.API.init(request, response, 
{  
jsonOutput: true,
authentication:false
}, function (){})

 

 

Marcel Szimonisz

MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/

Avatar

Correct answer by
Employee Advisor

@wankang ,

You can use REST APIs to get the session token in Regrame. While the Session#Logon() method is used to get the session token in SOAP protocol, you can use the POST /session/token API in REST to get the session token.

The POST /session/token API expects a JSON request body with the following format:

{

  "login": "<username>",

  "password": "<password>",

  "company": "<company>",

  "source": "<source>"

}

You need to replace the placeholders <username>, <password>, <company> and <source> with the actual values for your account. Once you have filled in the request body, you can make the API call to the Regrame server.

The API call will return a JSON response body with the session token:

{

  "token": "<session_token>",

  "expiration": "<expiration_time>"

}

You can extract the session token from the response body and use it to authenticate subsequent API calls to Regrame.

Note that the POST /session/token API uses HTTPS protocol for security, and you need to provide the appropriate authentication credentials in the request body to get the session token.

Avatar

Level 2

Hi @akshaaga,

 

What is a Regrame server, can you tell me the url where the POST should happen. It would be helpful

 

Regards,

DG 

Avatar

Level 4

Hi @akshaaga ,

Thanks for the above. I've been trying to use this REST endpoint to retrieve a session token but I can't find the full URL anywhere. Can you possibly advise? I've tried all the regular SOAP and JSSP URL structures without any luck.

Thanks in advance

Guillermo

Avatar

Administrator

Hi @wankang,

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks



Sukrity Wadhwa