Get started with SOAP APIs

Learn how to generate a session token using Postman for use in API requests.

Hello, and welcome to getting started with SOAP APIs in Campaign. In this video, we are going to learn how to generate a SessionToken using Postman for use in subsequent API requests. Let’s get started. First, we need to download and install the latest version of Postman. If you already have Postman, make sure it is up to date. Alternatively, the software SoapUI can be used in a similar fashion.
Once you have Postman installed, one of the first things we need to do is import the API collection. However, to do this, we will need to upload a text file. The text file will need to be created by copy and pasting an XML file from your browser.
Start by opening up a new Google Chrome tab, and copy and paste the following link.
In order for the link to work, you will need to modify the front part of the link to match the URL of the Campaign instance you plan on using. You can find this value in the Connections tab for the Campaign Client console.
After modifying the link and pressing enter in your browser, you’ll be asked to login and provide your Campaign credentials.
Once you enter your credentials and login, the following page is displayed. If you are already familiar with WSDL, you will know that WSDL is an XML format for describing network services as a set of endpoints. Every Campaign instance will have this static endpoint, and by changing the parameter for the schema value we can grab the XML file containing the endpoints we wish to use. Copy the entire XML file to a text document and save it to your local machine. Once complete open Postman, and from within the UI select Workspaces followed by creating a new workspace. I’m going to call my workspace Campaign Course and change the visibility to Personal.
After creating a workspace, we are ready to import our text file. From within the Collections tab, select Import and a popover appears. Normally we could have just provided the link, however, because this is password protected, we have to make a text file.
We can select Upload Files and navigate to our local files, or drag and drop the text file. Once complete, the Name, Format and Import As fields should match what I have on the screen.
After importing the collection we can select Collections, from the left sidebar, and the XtkSession collection is now available. We are now ready to generate our SessionToken, which will be used for the remainder of the course. Scroll down and select Logon POST Request. Then, within the request, select the Body tab.
A SOAP envelope is predefined, and all we have to do is fill in some information. To send a valid POST request, we will need to provide our login username, our password and modify the base URL. Let’s start by modifying the base URL. If we hover over the variable, you’ll notice the base URL is using HTTP and not HTTPS.
We need to modify this to use HTTPS for a valid POST request. To modify a collection variable, select the root collection folder, in our case this is XtkSession, followed by selecting the Variables tab. Next, let’s update the initial value to contain HTTPS followed by copy and pasting this to the current value. While we’re at it, I’m going to add my login credentials as variables I can call, within the collection, and create an empty variable where we can put our SessionToken.
Once complete, remember to save the changes.
Navigating back to the Logon POST Request, we can see that the base URL is now HTTPS.
Because I created variables for my username and password, earlier, I can add them into the body replacing the string.
Currently, we do not have a SessionToken, however, we do not need to provide one, and, instead, remove the string leaving the value empty. Once complete, select Send in the top right corner and a response object populates. In this response is pstrSessionToken, which contains our SessionToken value. We can copy and paste this value to our SessionToken variable, meaning we won’t have to constantly copy and paste the value for subsequent POST requests.
Note that the SessionToken only lasts 24 hours. After completing the response, save your changes to the POST request for ease of use in the future.
You should now have a Campaign API collection in Postman, and a SessionToken to use for subsequent API calls. Thanks for watching. -

Next video to watch: Step 2 - Add recipients and articles use SOAP API request