forked from membrane/api-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path30-Orchestration.yaml
More file actions
36 lines (35 loc) · 978 Bytes
/
30-Orchestration.yaml
File metadata and controls
36 lines (35 loc) · 978 Bytes
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
# yaml-language-server: $schema=https://www.membrane-api.io/v7.1.2.json
#
# Tutorial: Orchestration
#
# Shows how to create an API that combines two backend calls into one API.
# 1) Fetch a book by id.
# 2) Use the author key from the book payload to fetch the author.
#
# Try:
# curl localhost:2000/books/OL29474405M
# curl localhost:2000/books/OL26333978M
api:
port: 2000
path:
uri: /books/{id}
flow:
- request:
- call:
url: https://openlibrary.org/books/${pathParam.id}.json
- setProperty:
name: title
value: ${$.title}
language: jsonpath
- call:
url: https://openlibrary.org${$.authors[0].key}.json
language: jsonpath
- template:
contentType: application/json
src: |
{
"title": ${property.title},
"author": ${jsonPath('$.name')}
}
- return:
status: 200