-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathServiceBroker_TechnicalAccess.http
More file actions
78 lines (62 loc) · 3.39 KB
/
ServiceBroker_TechnicalAccess.http
File metadata and controls
78 lines (62 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This file contains sample calls to explain the usage of the service broker to access tenant-specific endpoints with a "technical user"
# It can be used with the SAP Business Application Studio extension "Rest Client" which is preinstalled with Dev Spaces of type "Full Stack Cloud Application"
# Please follow the tutorial "Enabling API access of SAP BTP applications using Service Broker" to configure the service broker
# Start with the service binding you created for the service broker instance in the consumer account, the name in the service tutorial was binding_full
# From that service binding take the fields
# "endpoints-psm-servicebroker" (Service Key API-Endpoint),
# "uaa-clientid" (Service Key UAA Client-ID),
# "uaa-clientsecret" (Service Key UAA Client-Secret),
# "uaa-url" (Service Key UAA-URL)
# and copy them into the below fields
# Afterwards you can send the requests listed below. Start by getting an access token. The requests use the user interface service "poetryslamservice" to get the data.
@endpoint = <put the Service Key API-Endpoint without quotation marks here>
@client_id = <put the Service Key UAA Client-ID without quotation marks here>
@client_secret = <put the Service Key UAA Client-Secret without quotation marks here>
@uaa_url = <put the Service Key UAA-URL without quotation marks here>
### Get access token from uaa-url providing client-id and client-secret as user/pw for Basic authentication
# @name tokenrequest
GET {{uaa_url}}/oauth/token?grant_type=client_credentials&response_type=token HTTP/1.1
Authorization: Basic {{client_id}}:{{client_secret}}
### Store Token
@token = {{tokenrequest.response.body.access_token}}
### Get all PoetrySlams
GET {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams
Authorization: Bearer {{token}}
### Get a single PoetrySlam
GET {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams?$filter=number%20eq%20'3'
Authorization: Bearer {{token}}
### Create a new slam (draft)
### This (and all subsequent examples) will fail in case you use a service binding for a service plan with ReadOnly scope (response will be 403 - forbidden)
# @name createdraft
POST {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams
Authorization: Bearer {{token}}
Content-Type: application/json
{}
### Store ID
@newid = {{createdraft.response.body.ID}}
### Read draft PoetrySlam
GET {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams(ID={{newid}},IsActiveEntity=false)
Authorization: Bearer {{token}}
### Update draft PoetrySlam
PATCH {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams(ID={{newid}},IsActiveEntity=false)
Authorization: Bearer {{token}}
Content-Type: application/json
{
"title": "Created through Service Broker",
"description": "This Poetry Slam was created and updated with a technical user access",
"maxVisitorsNumber": 10,
"visitorsFeeAmount": 0,
"visitorsFeeCurrency_code": "EUR",
"dateTime": "2024-01-01T12:00:00+01:00"
}
### Activate (Save) draft PoetrySlam
POST {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams(ID={{newid}},IsActiveEntity=false)/PoetrySlamService.draftActivate
Authorization: Bearer {{token}}
Content-Type: application/json
{}
### Read active PoetrySlam
GET {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams(ID={{newid}},IsActiveEntity=true)
Authorization: Bearer {{token}}
### Delete active PoetrySlam
DELETE {{endpoint}}/odata/v4/poetryslamservice/PoetrySlams(ID={{newid}},IsActiveEntity=true)
Authorization: Bearer {{token}}