get session Token use Restful API | Community
Skip to main content
wankang
Level 3
April 20, 2023
Solved

get session Token use Restful API

  • April 20, 2023
  • 5 replies
  • 2861 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by akshaaga

@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.

5 replies

Level 5
April 20, 2023

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).

wankang
wankangAuthor
Level 3
April 20, 2023

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.

Marcel_Szimonisz
Community Advisor
Community Advisor
April 20, 2023

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/

akshaaga
Adobe Employee
akshaagaAdobe EmployeeAccepted solution
Adobe Employee
April 21, 2023

@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.

Level 2
August 18, 2023

Hi @akshaaga,

 

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

 

Regards,

DG 

Sukrity_Wadhwa
Community Manager
Community Manager
May 4, 2023

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