Graphs

Assert

Description Performs an assertion over the scope. Arguments A javascript function which takes the scope as argument and returns true or false. Example: Checking that the scope contains a specific key. (scope) => { return scope.username !== null; } Example: Checking that the scope contains a specific value. (scope) => { return scope.user === {id: "12345", name: "Bob"}; } »

Assert Body

Description Performs an assertion over the last HTTP request’s body. Arguments A javascript function which takes the HTTP response’s body and the scope as argument and returns true or false. Example: Checking that the body contains a specific key. (body, scope) => { return body.user_id !== null; } Example: Checking that the body contains a specific value. (body, scope) => { return body.user.id === scope.userId; } »

Assert Headers

Description Performs an assertion over the last HTTP request’s headers. Arguments A javascript function which takes the HTTP response’s headers and the scope as argument and returns true or false. The headers are represented as a map from header key to header value. Example: Checking that the server returned a specific header: (headers, scope) => { return headers["x-auth-token"] !== null; } Example: Checking that the server returned a header with a specific value: »

Assert Status

Description The Assert Status is a type of assertion that verifies the HTTP status code of the last HTTP Response. The graph’s execution will be halted if any of the following conditions occur: The Http Response’s status is not in the range of from <= status <= to. There is no Http Response in the scope. Arguments from: The lower bound HTTP status code. to: The upper bound HTTP status code. »

Config

Description Sets text variables in the scope. Arguments A list of key-value pairs. The config node will set each key-value pair into the scope. Example: Setting your initial configuration variables. The following configuration Will result in the following scope { url: "https://myapi.co/api/3", username: "billybob" } »

Eval JS

Description Invokes a javascript function. The result of the invocation will be the new scope. Arguments A javascript function which takes the current scope as argument and returns the new scope. If you don’t return anything, Apibot will assume that you returned an empty map! So always remember to return the resulting scope. Example: Setting a “random” email in the scope. (scope) => { const millis = Date.now(); scope. »

Extract Body

Description Takes a value in the body of the last HTTP request and places it in the scope. Arguments Property Name: The name that will be given to the extracted contents inside the scope. Function: A javascript function which takes the body as argument and returns anything. Example: extracting an authentication token from the body. If the name is “token” and the functions is set as follows: (body) => { return body. »

Extract Header

Description Takes a header last HTTP request and places it in the scope. Arguments Property Name: The name that will be given to the extracted header inside the scope. Header Name: The name of the http header. Example: extracting the APIs version assuming an API that returns versions as headers. Will result in the following scope: { /* ... */ version: "<some API version>" } »

Http Request

Description The “Http Request node” makes an HTTP request and appends both the Http Request and Http Response to the scope. If an Http Request/Response was already in the scope, it will be overriden. Arguments Url: The HTTP request’s URL. Example: https://swapi.co/api/people/1. This value is templateable e.g. you can use ${root}/api/people/1 if the variable root is defined in the scope. Method: The HTTP method, e.g. GET Body: The request’s body, also sometimes called payload. »