opensearch-docs-cn/_automating-workflows/api/get-workflow.md

50 lines
1.7 KiB
Markdown

---
layout: default
title: Get a workflow
parent: Workflow APIs
nav_order: 20
---
# Get a workflow
This is an experimental feature and is not recommended for use in a production environment. For updates on the progress of the feature or if you want to leave feedback, see the associated [GitHub issue](https://github.com/opensearch-project/flow-framework/issues/475).
{: .warning}
The Get Workflow API retrieves the workflow template.
## Path and HTTP methods
```json
GET /_plugins/_flow_framework/workflow/<workflow_id>
```
## Path parameters
The following table lists the available path parameters.
| Parameter | Data type | Description |
| :--- | :--- | :--- |
| `workflow_id` | String | The ID of the workflow to be retrieved. Required. |
#### Example request
```json
GET /_plugins/_flow_framework/workflow/8xL8bowB8y25Tqfenm50
```
{% include copy-curl.html %}
#### Example response
To retrieve a template in YAML format, specify `Content-Type: application/yaml` in the request header:
```bash
curl -XGET "http://localhost:9200/_plugins/_flow_framework/workflow/8xL8bowB8y25Tqfenm50" -H 'Content-Type: application/yaml'
```
To retrieve a template in JSON format, specify `Content-Type: application/json` in the request header:
```bash
curl -XGET "http://localhost:9200/_plugins/_flow_framework/workflow/8xL8bowB8y25Tqfenm50" -H 'Content-Type: application/json'
```
OpenSearch responds with the stored template containing the same content as the body of the [create workflow]({{site.url}}{{site.baseurl}}/automating-workflows/api/create-workflow/) request. The order of fields in the returned template may not exactly match the original template but will function identically.