0% found this document useful (0 votes)
14 views22 pages

Creación Un Multi Action API

Creación un Multi Action API

Uploaded by

mario
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views22 pages

Creación Un Multi Action API

Creación un Multi Action API

Uploaded by

mario
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Creating a Multi Action API Step

Creating a Multi Action API Step

Explanation Screenshot

To learn more about


how a planning
modeler sets up and
configures an API
step for a multi action
and runs the multi
action, follow this
interactive tutorial.

Suppose you want to


employ the
capabilities of the
SAP BW system, an
external application,
to copy data you
need. To do this, you
need to add an API
step. For an API step
to work, an HTTP API
Connection has to be
created beforehand.

1. In SAP Analytics
Cloud, choose
Connections in the
side navigation.

1
Creating a Multi Action API Step

Explanation Screenshot

2. Under the
Connections tab,
choose Add
Connection.

3. In the Select a
data source dialog
box, select HTTP API
in the Connect to
Public API section.

4. In the Connection
Name field, enter
MAT2402 and press
Enter.

2
Creating a Multi Action API Step

Explanation Screenshot
5. The external
application you want
to use is an on-
premise system, so
you need to select
Connect to an On-
Premise generic
HTTP service.

Select Connect to an
On-Premise generic
HTTP service.

6. In the Data Service


URL field, enter
[Link]
[Link]/sap/b
w/ina/GetServerInfo
and press Enter.

The connection to the


external application
that you want to use
supports Basic
Authentication as its
authentication type.

This has been


selected by default.

3
Creating a Multi Action API Step

Explanation Screenshot

Enter your user name


and password for the
external application.

For this tutorial, this


has been done for
you.

7. Choose Create.

An HTTP API
Connection is
created.

4
Creating a Multi Action API Step

Explanation Screenshot

After finishing the


HTTP API
connection, we will
now create a multi
action API step.

8. Choose More >


Multi Actions.

9. Choose Multi
Action in the Create
New section.

5
Creating a Multi Action API Step

Explanation Screenshot

10. From the toolbar,


choose Add API
Step.

Alternatively, choose
+ Add Step > API
Step.

11. In the Step Name


field, enter
Data_copy and
press Enter.

12. To view the list of


HTTP API
connections, open
the list.

6
Creating a Multi Action API Step

Explanation Screenshot

13. Select the HTTP


API connection you
created.

For this tutorial,


select MAT2402.

14. In the API URL


field, enter
[Link]
[Link]/sap/d
emo/task/execute?
mode=sync and
press Enter.

15. The external


application you want
to use requires a
CSRF token as a
layer of protection,
you need to select
the Require CSRF
Token check box and
enter a CSRF token
URL.

To enable it, select


the Require CSRF
Token check box.

7
Creating a Multi Action API Step

Explanation Screenshot

If you do not enter a


CSRF token URL, the
request API URL will
be used by default to
get the CSRF token.
The request API URL
works in your case so
you can leave the
CSRF Token URL
field empty.

Enter the request


payload in the Body.

For this tutorial, this


has been done for
you.

The request payload


must be in JSON
format. You can
select Format to
format the request
payload. If you need
more space for the
request payload,
select the Edit JSON
icon in the top right
corner.

8
Creating a Multi Action API Step

Explanation Screenshot
This request payload
puts filters on three
dimensions to control
what will be copied.
You restrict
"ZLENTITY" to "CN"
as you only want to
copy the product data
for China. You leave
the members for
"ZLPRODUCT" and
"0CALMONTH"
dimensions empty as
you want to use
parameters to give
you more flexibility,
choosing parameter
values as needed
when running the
multi action that
includes this API
step.

16. To add a
parameter for the
dimension
"ZLPRODUCT",
place the cursor after
"MBR": of Line 5 and
choose Insert
Parameters > Create
Parameter.

9
Creating a Multi Action API Step

Explanation Screenshot

The Parameter Detail


panel appears.

For this tutorial,


settings for this
parameter have been
configured for you.

17. Choose Done.

You are back to the


Step Details panel of
your API step and the
"Product" parameter
has been created and
added to the request
payload, followed by
".baseMembers".
This will pass all leaf
members for the
parameter value
(member) you select
when running the
multi action.

10
Creating a Multi Action API Step

Explanation Screenshot

To add a parameter
for the dimension
"0CALMONTH",
place the cursor after
"MBR": of Line 13
and choose Insert
Parameters > Create
Parameter.

For this tutorial, this


parameter has been
created and added to
the request payload
for you.

18. The API step will


send the request
payload to the
external application
to trigger it, and you
need to select where
to get the trigger
status. If you select
Get API trigger status
from HTTP status
code and response
body, the response
body will also be
evaluated. The
external application
used in this tutorial
requires getting
information about the
trigger status from
the response body.

Under Response,
select Get API trigger
status from HTTP
status code and
response body.

11
Creating a Multi Action API Step

Explanation Screenshot
19. If the external
application that will
be triggered by the
API step does not
use the field names
designated by the
API step, so you
need to configure
fields mapping, to
map the fields of the
external application
with the fields of the
API step.

Select Configure
fields mapping.

In the Enter JSON


section of the Fields
Mapping dialog box,
enter the JSON
response from the
external application
that includes all the
required fields.

You can either copy


and paste it or type it.
Choosing Format will
help you fix format
issues so that fields
can be parsed
correctly.

12
Creating a Multi Action API Step

Explanation Screenshot

20. For this tutorial,


the JSON response
has been added for
you.

Choose Next.

21. To map the


correct field in the
external application
with Job ID, select
the jobId from Field in
External Application.

22. Choose the


arrow.

13
Creating a Multi Action API Step

Explanation Screenshot

The field jobId of the


external application is
mapped to the field
Job ID of the API
step, represented by
the equal sign.

To map the correct


field in the external
application with
Status, select status
from Field in External
Application and
choose the second
arrow.

To map the correct


field in the external
application with
Message, select
message from Field
in External
Application and
choose the last
arrow.

For this tutorial, this


has been done for
you.

14
Creating a Multi Action API Step

Explanation Screenshot

23. All fields in the


external application
have been mapped
with fields in the API
step.

Choose Next.

24. You have the


knowledge of what is
the corresponding
status value of the
external application
for each status value
in the API step.

To map with DONE,


the first API step
status value, in the
first input field for
External Application
Status Value, enter
SUCCESSED, which
is the external
application status
value that represents
the same status, and
press Enter.

15
Creating a Multi Action API Step

Explanation Screenshot

For FAILED, the


second API step
status value, the
external application
status value that
represents the same
status is already
matched with it, so
you can leave the
second input field
empty.

25. To map with


IN_PROCESS, the
last API step status
value, in the last input
field for External
Application Status
Value, enter
RUNNING, which is
the external
application status
value that represents
the same status, and
press Enter.

26. API step status


values are now
mapped to external
application ones.

Choose OK.

16
Creating a Multi Action API Step

Explanation Screenshot
27. You need to
select the method for
your request to get
the API execution
result. The selection
depends on which
method the external
application supports.
For this tutorial, you
need to select
Synchronous Return.

Open the Method list.

28. Select
Synchronous Return.

If you want to use an


external application
that supports
Asynchronous
Return, you also
need to enter the
Polling API URL. The
settings for where to
get the API execution
result and fields
mapping work are the
same as those for
triggering the API.

17
Creating a Multi Action API Step

Explanation Screenshot

29. To save the multi


action you just
configured, choose
Save.

30. Select Save.

31. In the Search


field, enter Multi
Action Interactive
Tutorial2 and press
Enter.

18
Creating a Multi Action API Step

Explanation Screenshot

32. Select the Multi


Action Interactive
Tutorial2 folder.

33. In the Name field,


enter Data_copy and
press Enter.

34. Choose OK.

19
Creating a Multi Action API Step

Explanation Screenshot

To run your multi


action, you first need
to go to the relevant
story and add a multi
action starter.

For this tutorial, we


will navigate to the
story, add a multi
action starter, and
save the story for
you.

35. To run the multi


action, select the
starter icon of the
Data copy multi
action.

In the execution
dialog that appears,
you will see the
values for two multi
action parameters
you added to the
request body of the
API steps are empty.

You can set the


values to control
which data will be
copied. You want to
copy the data of
IPHONE6P128GB in

20
Creating a Multi Action API Step

Explanation Screenshot
July 2023.

Select
IPHONE6P128GB for
Product and July
2023 for Date.

For this tutorial, this


has been done for
you.

36. Choose Run.

After the multi action


is run successfully,
the data of amount of
IPHONE6P128GB for
July 2023 has been
copied and pasted to
the table on the right.

21
Creating a Multi Action API Step

Explanation Screenshot

You have
successfully set up
and configured an
API step for a multi
action and run the
multi action.

This concludes the


interactive tutorial.

22

You might also like