Skip to content

Commit 8c4579d

Browse files
committed
minor improvements to hcp-abh-test-locally
- standardise on entityset (vs entity set) - generalise the "maximise" button reference (as it's changed) - explain the trailing escaped newline in the code snippet from the hub - explain the default sticky scroll behaviour in dev space terminals - draw attention to the $inlinecount option
1 parent b073aed commit 8c4579d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

tutorials/hcp-abh-test-locally/hcp-abh-test-locally.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tags: [ tutorial>beginner, products>sap-business-technology-platform, topic>sap
1313

1414
## Prerequisites
1515
- A trial account on the SAP Business Technology Platform
16-
- A subscription to the SAP Business Application Studio, with a basic dev space set up
16+
- A subscription to the SAP Business Application Studio
1717

1818
See [Create a Dev Space for Business Applications](https://developers.sap.com/tutorials/appstudio-devspace-create.html).
1919

@@ -60,7 +60,7 @@ These notes might help you to better examine and understand the invocation:
6060
- The `--request GET` option is actually unnecessary as `curl` will use the method appropriate to the rest of the options given; in this case it will automatically use `GET`.
6161
- The OData system query options have been URL-encoded (this is actually called [Percent-encoding](https://en.wikipedia.org/wiki/Percent-encoding)). Specifically, the occurrences of `%24` are just `$` characters, encoded. Knowing this may make reading the URL easier, in that they are the start of normal OData query parameters `$inlinecount=allpages` and `$top=50`.
6262
- The `DataServiceVersion: 2.0` header is to explicitly signal that the request is for OData V2; this is optional, and arguably unnecessary as the OData API only supports V2 anyway.
63-
- Perhaps the most interesting header here is the `Accept: application/json`. This forms part of standard HTTP [content negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Content_negotiation) and here represents a desire for the resource being requested to be returned in a JSON representation. If the value of this header were to be set to `application/xml` then the entity set resource would be returned in an XML representation, aligned with what OData supports.
63+
- Perhaps the most interesting header here is the `Accept: application/json`. This forms part of standard HTTP [content negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Content_negotiation) and here represents a desire for the resource being requested to be returned in a JSON representation. If the value of this header were to be set to `application/xml` then the entityset resource would be returned in an XML representation, aligned with what OData supports.
6464

6565

6666
### Get ready to run the code snippet
@@ -71,12 +71,14 @@ In the SAP Business Application Studio, create a dev space, giving it a name and
7171

7272
> You can choose any kind of dev space, but to emphasize that the command line tools you'll be using are available in all of them, we want you to choose this "Basic" kind.
7373
74-
Once the dev space has started up, open up a terminal with the menu path **Terminal -> New Terminal** (the menu is available via the three horizontal bar icon in the top left). Now you have a shell prompt in which to run the code snippet, specifically invoking `curl`. At this point you may wish to maximize the terminal with the up arrow (`^`) button on the right hand side.
74+
Once the dev space has started up, open up a terminal with the menu path **Terminal -> New Terminal** (the menu is available via the three horizontal bar icon in the top left). Now you have a shell prompt in which to run the code snippet, specifically invoking `curl`. At this point you may wish to maximize the terminal with the appropriate button on the right hand side.
7575

76-
Copy the code snippet from the SAP Business Accelerator Hub page and paste it into the terminal. When you run the command, you should see output that looks something like this:
76+
Copy the code snippet from the SAP Business Accelerator Hub page and paste it into the terminal, making sure to either omit the last escaped newline (the `\` symbol at the end of the last line) or include the whitespace and comment that follows the command, when copying. When you run the command, you should see output that looks something like this:
7777

7878
![request complete, JSON representation shown, unformatted](json-output-unformatted.png)
7979

80+
> Because of the default behavior of dev space terminals in the SAP Business Application Studio, which includes "sticky scroll" being enabled, it looks like a trailing backslash was indeed the last thing pasted in, but that's not the case - the trailing comment was included too.
81+
8082
You'll notice that the output is not formatted and is not easy to read. To address this you can use the command line JSON processor [jq](https://jqlang.org/). It's not just a JSON formatter, it's an entire language for handling, processing, generating and modifying JSON data, but here we'll just use its most basic feature, which is the identity function `.`. This just emits what's received, with no transformations. How is that useful? Well, unless you say otherwise (with the `-c` and `-M` options, in case you're curious), `jq` will, by default, pretty-print (and colorize) any JSON it emits.
8183

8284
> You can also invoke `jq` just on its own, without specifying the `.` identity filter; in this case, the identity filter will be used as default anyway.
@@ -127,7 +129,9 @@ The output should now appear pretty-printed, something like this (all but one of
127129
}
128130
```
129131

130-
The formatted output represents the results of a simple call to the Campaign Collection API endpoint - an OData entity set.
132+
The formatted output represents the results of a simple call to the Campaign Collection API endpoint - an OData entityset.
133+
134+
> Depending on the parameter settings in the Try Out facility, you may or may not see the `$inlinecount=allpages` option in use, which causes a top level `__count` property to be included in the resource output. You may wish to experiment with setting a value for `$inlinecount` in the Parameters section.
131135
132136
### Modify your request
133137

0 commit comments

Comments
 (0)