Dieser Artikel ist auf German nicht verfügbar. Sehen Sie ihn sich auf English an
service
TABLE OF CONTENTS
Fetch information from an external service
Definition
any service(string $service, string $operation, any $data)
Fetches information from a connected service. The service needs to first be defined under Connected services.
Parameters
string $service
Name of the service.
string $operation
Name of the operation.
any $data
Data to send.
Returns
any
The response body of an external service.
Examples
The setup of the external service is relevant here as well:
- Service name:
ExampleService - Operations:
getByID- Request type:
GET - URL: https://jsonplaceholder.typicode.com/posts/:id
- Response type:
JSON.
- Request type:
postToDirectory- Request type:
POST, - URL: https://jsonplaceholder.typicode.com/:directory
- Response type:
JSON.
- Request type:
Sample data
{
"post": {
"id": "3"
}
}Transformation
{
a: service('ExampleService', 'getByID', {
id: post.id
}),
b: service('ExampleService', 'postToDirectory', {
"directory": 'posts',
"userId": `7`,
"title": 'ExampleTitle',
"body": 'ExampleText'
})
}Result
{
"a": {
"userId": 1,
"id": 3,
"title": "ea molestias quasi exercitationem repellat qui ipsa sit aut",
"body": "et iusto sed quo iure\nvoluptatem occaecati omnis eligendi aut ad\nvoluptatem doloribus vel accusantiu... (TRUNCATED)"
},
"b": {
"userId": 7,
"title": "ExampleTitle",
"body": "ExampleText",
"id": 101
}
}Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article