Example: web_restAction Functions

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

C Language

int web_rest( const char *StepName, "URL=<URL>", "Method=<HTML method>", "EncType=<encoding type>","Body=<body of message>" ,"Snapshot=<snapshot file>", [[ITEMDATA [["Name=<name>", "Value|FileName=<value>", ENDITEM,]] ]] [[HEADERS [["Name=<header name>", "Value=<value>", ENDHEADER,]] ]] LAST);

Property Name
StepName The name of the step, as it appears in the graphical script.
URL The URL of the REST resource.

Any method supported by the HTTP protocol.


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.

BodyThe 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>.
headersHeader names and values.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.


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.


This is an example of a post:

web_rest("POST: www.mysite.com",
      "Name=Key1", "Value=Value1", 
      "Name=Key2", "FileName=C:\Program Files (x86)\SAP\FrontEnd\__sap.dir",  
      Name=Accept", "Value=text/html",