Adding an API Step

In SAP Analytics Cloud, API steps integrate on-premise and cloud-based external applications using an HTTP Application Programming Interface (API).

Context

Before adding an API step, you need to create a multi action. For more information, see Create a Multi Action.

Learning Tutorial

Navigate through the interactive tutorial illustrating how to configure an HTTP API connection, create a multi action API step, and run it in step-by-step instructions (4:00 min); the tutorial is captioned exclusively in English:

Procedure

  1. From the toolbar, select (Add API Step).
  2. Type a name for the step.
  3. From the Connection list, select the connection you want to use. If the connection you want to use is not available, go to the Connections page and add the HTTP API connection under Connect to Public API. For more information, check this blog post Integrate External Applications Using Multi Actions in SAP Analytics CloudInformation published on SAP site.
  4. Enter the API URL.
  5. In the Method field, POST is automatically selected. The POST request sends data to the API server.
  6. Expand the Default Header Fields and check the Key/Value pairs.
    • If needed, you can add header fields. Additional header fields allow only 'Prefer':'respond-async' and customized headers with keys beginning with 'X-', except x-forwarded-host.

    • To set multiple values for a header field, you can separate the values using a comma or enter multiple header fields with the same key.

  7. Select the Require CSRF Token checkbox if a CSRF token is required before a POST request can be made. Enter the required CSRF token URL to get the CSRF token.
  8. Enter the request payload in the Body. The request payload must be in JSON format. If you need more space for the request payload, select the (Edit JSON) button.
  9. If desired, add parameters for the value. You can do this by choosing (Insert Parameters) in the designer panel or by choosing (Insert Parameters) in the Edit JSON dialog.
    • Valid parameter types are Number, Member, String, and Date and Time. For the Date and Time parameter, use the ISO date format of YYYY-MM-DD. To learn more about the types of parameters, see Add Parameters to Your Data Actions and Multi Actions.

    • When adding parameters, you can also choose to add .baseMembers to include all child members of the chosen parameter. However, this is not supported for number parameters.

    • If you choose multiple values for a parameter, the values are sent as an array, separated by commas. After .baseMembers, you can add .toString() to convert parameter values in array format to ones in string format. You can also specify the separator for parameter values by enclosing it in single quotes. For example, to use the semicolon as the separator, you should enter .toString(';'). If you don't define a separator, the comma will be used by default.

    • Adding parameters is not supported for keys.

  10. Under Response, choose a fixed field to get the response from or, if the external application does not use the field names designated by the API step, configure the fields mapping.
    • Get the API trigger status from the HTTP status code, or from both the HTTP status code and response body.

    • Configure the fields mapping. To overwrite the default field values:

      1. Enter a valid JSON from the external application that has all the required fields.

      2. Map the fields from the external application with the fields in the API step.

      3. Map the status values of the external application with the fields in the API step.

  11. Under Get API Execution Result, in the Method field, choose Asynchronous Return or Synchronous Return.
  12. Choose a fixed field to get the API execution result from or, if you are using Asynchronous Return, you can configure the fields mapping.

Results

The API step is added to the multi action. You can continue to add, manage, and reorder steps as required.

Configure HTTP Headers for the Multi Action API Step

Here's information on which characters you can use in header field names in the multi action API step.

Allowed Elements in Header Field Names

Use the following characters for header field names in the multi action API step, according to the HTTP protocol.

Character

Status

0-9

Allowed

A-Z

Allowed

a-z

Allowed

"

Allowed

!

Allowed

#

Allowed

$

Allowed

%

Allowed

&

Allowed

'

Allowed

*

Allowed

+

Allowed

-

Allowed

.

Allowed

^

Allowed

_

Allowed

`

Allowed

|

Allowed

~

Allowed

Restricted Elements in Header Field Names

Don't use the following header field names because they're reserved for other purposes. You'll get an error message, "This header key isn't allowed."

Restricted Headers

Header

Status

host

N/A

method

N/A

from

N/A

cookie

N/A

origin

N/A

referer

N/A

content-length

N/A

content-location

N/A

content-md5

N/A

content-range

N/A

date

N/A

server

N/A

via

N/A

etag

N/A

expires

N/A

warning

N/A

accept-encoding

N/A

accept-language

N/A

cache-control

N/A

dnt

N/A

pragma

N/A

priority

N/A

user-agent

N/A

traceparent

N/A

tracestate

N/A

expect

N/A

max-forwards

N/A

request-uri

N/A

vary

N/A

x-forwarded-host

N/A

connection

N/A

keep-alive

N/A

proxy-authorization

N/A

te

N/A

trailers

N/A

transfer-encoding

N/A

upgrade

N/A

authorization

N/A

accept

N/A

content-type

N/A