You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- description --> Try out an SAP API locally on your machine.
13
+
12
14
## Prerequisites
13
15
- Make sure you have the command line tools curl and jq installed.
14
16
- Windows instructions: [curl](https://chocolatey.org/packages/Curl) and [jq](https://chocolatey.org/packages/jq)
15
17
- MacOS/Unix instructions: [jq](https://stedolan.github.io/jq/download/) (curl should already be available)
16
18
17
-
## Details
18
-
### You will learn
19
+
## You will learn
19
20
- How to use command line tools like curl and jq with REST / OData APIs locally.
20
21
21
-
You have already discovered the SAP Business Accelerator Hub and accomplished testing an API on the website. In this tutorial, you will learn how to use command-line tools like curl and jq to test REST/OData APIs locally on your machine.
22
+
## Intro
23
+
You have already discovered the SAP API Business Hub and accomplished testing an API on the website. In this tutorial, you will learn how to use command-line tools like curl and jq to test REST/OData APIs locally on your machine.
22
24
23
25
---
24
26
25
-
[ACCORDION-BEGIN [Step : ](Navigate to the User Management API)]
27
+
### Navigate to the User Management API
26
28
27
29
Go to <https://api.sap.com> and navigate to the [Campaign](https://api.sap.com/api/campaign/overview) API.
28
30
29
31

30
32
31
-
[DONE]
32
-
[ACCORDION-END]
33
-
[ACCORDION-BEGIN [Step : ](Generate sample API call code)]
33
+
### Generate sample API call code
34
34
35
-
Select `GET/CampaignCollection` method under **API Reference**. Glance through the `GET/CampaignCollection` to understand the parameters. The SAP Business Accelerator Hub provides you with starter code in a variety of languages and tools for each API.
35
+
Select `GET/CampaignCollection` method under **API Reference**. Glance through the `GET/CampaignCollection` to understand the parameters. The SAP API Business Hub provides you with starter code in a variety of languages and tools for each API.
36
36
37
37

38
38
@@ -50,9 +50,7 @@ Copy the highlighted curl code to the clipboard.
50
50

51
51
52
52
53
-
[DONE]
54
-
[ACCORDION-END]
55
-
[ACCORDION-BEGIN [Step : ](Run sample API call code)]
53
+
### Run sample API call code
56
54
57
55
Paste the content of the clipboard in a terminal or command line window. Hit **Enter** to run the command. It may take a few seconds before data is seen on your screen.
58
56
@@ -68,16 +66,12 @@ The formatted output represents the results of a simple call to the Campaign Col
68
66
69
67

70
68
71
-
[DONE]
72
-
[ACCORDION-END]
73
-
[ACCORDION-BEGIN [Step : ](Limit the number of results)]
69
+
### Limit the number of results
74
70
You can limit the number of results retrieved with the `$top` value provided in the *Parameter* section of the `GET/CampaignCollection` method. Switch back for a moment from the Code Snippet section to the Parameters section in the [Try Out](https://api.sap.com/api/campaign/tryout) area and modify the value of the `$top` parameter to request just 3 results.
75
71
76
72
You can then switch back to the Code Snippet section, and copy the updated code from the Curl section to paste it into your terminal. When you execute the curl command, and pipe the output into jq again, you should see a nicely formatted list of three campaigns.
77
73
78
-
[DONE]
79
-
[ACCORDION-END]
80
-
[ACCORDION-BEGIN [Step : ](Add multiple parameters to the API call)]
74
+
### Add multiple parameters to the API call
81
75
Besides the `$top` parameter, you can add multiple parameters to the [Query String](https://en.wikipedia.org/wiki/Query_string) of your API call.
82
76
Now add in a second parameter for `$select`. You only want the `StatusText` and `Status` for the top 3 users. Use the same approach as before - switch to the Parameters section, specify the two values for the `$select` parameter using the drop down menu, then switch back to the Code Snippet section and copy the Curl content again. It should look something like this:
83
77
@@ -99,6 +93,3 @@ Paste the entire command into your terminal again. This time the output is vastl
99
93
100
94
You have now learnt how to use code snippets productively.
0 commit comments