HttpDeleteRequest

HttpDeleteRequest

What to use it for
Prerequisites for usage
Essential properties to set

Use the HttpDeleteRequest to ask a server to delete something.

 Read more

About HTTP requests

In essence, data communication over the Internet consists of machines responding to each other's requests. An example is surfing on the web: Your browser requests a web page from a web server, and in turn that web server sends you the data of the web page.

Types of requests

There are more requests possible than merely this so called 'get' request:

  • Get a resource - Get request (a resource can be anything: A page, an image, a database entry, etc.)
  • Only get metadata (i.e. headers) about a resource - Head request
  • Modify a resource - Put request
  • Delete a resource - Delete request
  • Create a new resource - Post request
  • Ask which requests this resource accepts - Options request

Elements of a basic request

To be able to interact with a web server, it needs to have enabled a web service. The web service needs to know at least:

  • The type of request you are making (get, put, etc.).
  • To what the request should be applied (i.e. the location of the resource).

 

 

  • SmartBridge 3 or higher.
  • Party that accepts HTTP requests (i.e. web services).

 

  • Authentication type
  • Url
  • Response

You can use VB expressions (within the boundaries of the expected values), but no Workflow Macros or wildcards.

Misc

OptionWhat is itHow to use it
Authentication type

 

Option to indicate the type of authentication that is required by the server you are interacting with.

 

If you need other authentication types like for example OAuth 2.0 Bearer Tokens, use query string parameters or headers to achieve your goal.

  • None - The server does not require any authentication (default)
  • Basic - The server requires you to provide an (unencrypted) user name and password.

     

     

User name

Option to indicate the user name that is required by the server you are interacting with.

Only relevant in case the server requires basic authentication.

Enter a user name.
Password

Option to indicate the password that is required by the server you are interacting with.

Only relevant in case the server requires basic authentication.

Enter a password.
Url

 

The location of the resource to perform the action on. Enter an absolute (parameterized) URL.
Http headersOption to indicate which headers should be sent along with the requested action. (Optional)

Click on the Define button to define one or more headers. Provide:

  • Official name of the header (e.g. 'Accept-Charset').
  • Type of data (is always 'string').
  • The data that will serve as header value (e.g. 'UTF-8').

Enter one of the following values:

 Read more
  • Constant.
  • Variable, of the type string.
    • Use the variable editor at the bottom of the Workflow Studio screen to define a variable.
  • A VB expression that results in a string.

Query string parameters

Option to indicate additional query string parameters, to further specify the URL (Optional). The URL can be parameterized as shown below to enable replacement with the values and keys defined in the query string parameter dialog.

http://api.com/api/resource/{id}?search={search}

Click on the Define button to define one or more query strings. Provide:

  • Query parameter (e.g. 'id').
  • Type of data (is always 'string').
  • Query value (e.g. '21').
Response

Option to save the resulting server response to a variable of type Diversity.Activities.Model.HttpReponse, for use later in the Workflow.

 Read more

About the HTTP server response

A server response is an object with the following elements:

  • HTTP status code - Numeric code that indicates the status of the request
    • Examples: 200 = request was successful, 404 = requested data cannot be found.
  • Reason phrase - Short, textual explanation of the status code (see above).
  • Headers - Metadata about the content.
    • Could contain information such as: document encoding type, document last modified.
  • Body - Document content.

Differences in server responses

  • Servers will send all elements as a response, but depending on the server API some elements might be empty.
  • For SmartBridge, in many cases the only essential element of a server response is the status code.
  • POST request: Additional response elements that are essential are the headers and body.
  • GET request: Responses could take many forms (JSON, HTML, etc.).

Create a variable of type Diversity.Activities.Model.HttpReponse to save the result to.

 Read more
Why do I need variables

You can use variables to create a more flexible and sustainable Workflow.

Variables are mostly used in advanced Activities such as the Diversity Activities. These Activities often have two parts:

  • One part is to identify where to get data that serves as input for the Activity.
  • One part is to identify where to store data that serves as output for the Activity.

For the Diversity Activities it is common to store the data resulting from the Activity into a variable. Once stored in the variable, you can re-use the stored value elsewhere in the Workflow, by referring to the variable.

To create a variable to store data
  1. Click on the Variables button, below the Workflow. a panel will appear, containing an editable table.
  2. In the table click on 'Create variable' to start creating a new variable.
  3. Provide a name for the variable, preferably a name that describes its contents. Use camel case.
  4. Indicate the type of variable (e.g. boolean, integer, string, etc.). You can find specific types using 'Browse for types...'.
  5. Moving to another row saves this data to a new entry.

You can now use the name of this variable into one of the fields of the current Activity, or in Activities that are next.

All HTTP request Activities