Share this page

# web.rest

Sends a REST API request using any method supported by HTTP.

Example | Action Functions

## Syntax

    web.rest( {object} );

## JavaScript Object

    {
        stepName: "<string>",
        url: "<string>",
        method: "<string>",
        enctype: "<string>",
        body: "<string>",
        itemData: [{"name":"Name","value":"value","filename":"FileName"}],
        headers: [{"name":"Name","value":"Value"}],
    }

Property Name | Description
--- | ---
stepName | The name of the step, as it appears in the graphical script.
url | The URL of the REST resource.
method | Any method supported by the HTTP protocol.
encType | The encoding type. For example, multipart/form_data, application/x-www-form-urlencoded, or raw. If the encoding type is raw, a Content-type header is required. Use only with POST, PUT, DELETE, and OPTIONS methods.
body | The body of the request.
itemData | Key-value pairs for the data to be POSTed or for URL parameters. If the value is a literal or parameter, the syntax is `name:<Keyname>, Value: <value expression>`. If the value is in a file, the syntax is `name:<Keyname>, filename: <full path name>`.
headers | Header names and values.

## Return Values

Not applicable

## Parameterization

The values of keyword-value pairs can be parameterized. For example, "ALT={altParam}".

## General Information

The web.rest function is an action function that submits a REST request.

web.rest is not recorded. You can add it manually to a script.

The HTTP header can be modified to pass additional information about the request to the server. Using HTTP headers you can, for example, allow other content types in the response such as compressed files, or you can request a web page only on certain conditions.

The method can be any method supported by the HTTP protocol. For example:

- GET - retrieves a specific Resource from the Server.
- POST - creates a new resource on the server.
- PUT- updates the resource on the server.
- DELETE - removes the resource from the server.
- HEAD -retrieves the meta-data of the resource.
- OPTIONS - retrieves information about actions that are supported for the resource.

## Example

    web.rest(
       {
            name : 'POST: http://myserver/cgi-bin/cgi_upload.exe',
            url : 'http://myserver/cgi-bin/cgi_upload.exe',
            method : 'POST',
            enctype : 'multipart/form-data',
            itemData :
          [
               { name : 'rr', value : 'rr' },
               { name : '666', filename : 'C:\\scripts\\Rest_JS\\output.txt' }
          ],
            headers :
          [
               { name : 'Header1', value : '222' },
               { name : 'Accept-Ranges', value : 'eee' }
          ]
       }
    );

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: