Back to basics: Using curl in the SAP enterprise landscape

preview_player
Показать описание
There are many HTTP clients to use when exploring and consuming resources in the SAP enterprise landscape. Learn what you need to know about the powerful command-line HTTP client curl in this episode. Everyone welcome, especially beginners!

Discussion:

Topics:
HTTP, curl, command line, SAP Service Manager, SAP Business Technology Platform, OAuth 2.0, btp CLI, pass, jq, ijq

Links:

Chapters:
00:00 Welcome and introduction
07:00 Off to the SAP Business API Hub to look at the task in hand
08:30 Examining the Service Manager API
10:22 Looking at the SAP Help Portal docu on how to get an access token and authenticate the calls
10:40 Considering the two OAuth 2.0 flows in use
11:15 Realising I'm an idiot and had completely missed the content-type header in my quiz question
13:36 Examining the docu's curl sample to retrieve a token
16:02 Exploring curl's help features
18:10 Considering HTTP POST and curl's many facilities for that
19:00 A short digression into getting curl to follow redirects with --location, and an examination of --verbose output
26:20 Looking at a more comfortable way to express x-www-form-urlencoded name/value pairs with multiple --data parameters
30:15 Digging into why the authenticated request for an access token failed: lack of URL encoding of the values
32:30 Examining the --data-urlencode parameter option, as opposed to --data
35:17 Comparing --include (show the response headers) with --verbose
36:19 Celebrating the receipt of an access token
38:40 Trying out a deliberately over-simplified curl request (without authentication)
41:10 Adding, with the --header parameter, a specific Authorization header
41:33 Comparing that with the use of --user which generates an Authorization header with some Base64 encoded string for a Basic authentication header automatically
44:15 A successfully authenticated call to the /v1/service_offerings endpoint
45:28 Avoiding curl's progress indicators with --silent
46:55 Getting ready to create a service instance with a POST request and a file-based payload with the @ mechanism of curl's --data parameter
50:22 'Useless use of cat' award from shellcheck, hurray!
52:00 Examining why we received an error "unsupported media type"
52:48 An unexpected but always welcome WhatsApp call from my son Joseph
53:40 Fixing the call with another --header parameter to specify that the Content-Type is of the payload I'm sending is application/json (curl sends application/x-www-form-urlencoded by default)
54:02 Getting a lovely HTTP 201 CREATED response (altho the Location header is missing) and checking the result with ijq and also the btp CLI
57:00 Finally, using curl to delete the instance (with the --request DELETE parameter)
Рекомендации по теме