Issue.
Most commonly, to send am any type of request in a FC API, you need to have a valid session ID.
It is quite hard to copy the ID of the currently open session and enter it manually every time it is needed.
To save session ID to automate API requests in FC 12 API you can use an approach described below.
Solution
Open a session with a method described in the documentation with the link OpenSession. It will look like this on the screen below.
In a Test TAB you can pars an XML output and save a "sessionId" collection variable to use in you API requests.
Thus, to send a request, for example, to check if the Session Exists or not, you don't need to have a session ID value, just use a value from the collection variable. Find Example below.
You can use the same approach to save a value of the needed data to automate your API application.
Note! To get a value of the parameter you like, you need to specify exactly the node you need to find according to the structure of the response.
For example, for the sessionId please find a structure and a code snippet, below.
The code snippet example.
var responseJson = xml2Json(responseBody);
SessionId=responseJson['soap:Envelope']['soap:Body']['OpenSessionResponse']['sessionId'];
pm.collectionVariables.set("SessionId", SessionId);
Comments
0 comments
Please sign in to leave a comment.