Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ Invoke-RestMethod -Method Post `

The response will confirm the workflow orchestration has started:

```text
Workflow orchestration started for CancelOrder. Orchestration runId: abc123def456
```json
{
"runId": "abc123def456",
"message": "Workflow orchestration started for CancelOrder."
}
```

Workflow run responses use JSON by default. Include `Accept: text/plain` to request the legacy plain-text representation instead.

> **Tip:** You can provide a custom run ID by appending a `runId` query parameter:
>
> ```bash
Expand All @@ -68,51 +73,50 @@ Workflow orchestration started for CancelOrder. Orchestration runId: abc123def45

### Wait for the Workflow Result

By default, the HTTP endpoint returns `202 Accepted` immediately with the run ID. If you want to wait for the workflow to complete and get the result in the response, add the `x-ms-wait-for-response: true` header:
By default, the HTTP endpoint returns `202 Accepted` immediately with the run ID. To wait for the workflow to complete, set `waitForResponse=true` in the query string. The endpoint waits for up to 10 seconds by default; set `timeoutSeconds` to use a timeout from 1 to 200 seconds. If the workflow is still running when the timeout expires, the endpoint returns the same `202 Accepted` response as the default asynchronous invocation.

Bash (Linux/macOS/WSL):

```bash
curl -X POST http://localhost:7071/api/workflows/CancelOrder/run \
curl -X POST "http://localhost:7071/api/workflows/CancelOrder/run?waitForResponse=true&timeoutSeconds=30" \
-H "Content-Type: text/plain" \
-H "x-ms-wait-for-response: true" \
-d "12345"
```

PowerShell:

```powershell
Invoke-RestMethod -Method Post `
-Uri http://localhost:7071/api/workflows/CancelOrder/run `
-Uri "http://localhost:7071/api/workflows/CancelOrder/run?waitForResponse=true&timeoutSeconds=30" `
-ContentType text/plain `
-Headers @{ "x-ms-wait-for-response" = "true" } `
-Body "12345"
```

The response will contain the workflow result as plain text (200 OK):
The response is JSON by default:

```text
Cancellation email sent for order 12345 to jerry@example.com.
```json
{
"runId": "abc123def456",
"workflowStatus": "Completed",
"result": "Cancellation email sent for order 12345 to jerry@example.com."
}
```

To get the result as JSON, also include the `Accept: application/json` header:
To get only the workflow result as plain text, include the `Accept: text/plain` header:

```bash
curl -X POST http://localhost:7071/api/workflows/CancelOrder/run \
curl -X POST "http://localhost:7071/api/workflows/CancelOrder/run?waitForResponse=true" \
-H "Content-Type: text/plain" \
-H "x-ms-wait-for-response: true" \
-H "Accept: application/json" \
-H "Accept: text/plain" \
-d "12345"
```

```json
{
"runId": "abc123def456",
"workflowStatus": "Completed",
"result": "Cancellation email sent for order 12345 to jerry@example.com."
}
```text
Cancellation email sent for order 12345 to jerry@example.com.
```

The `x-ms-wait-for-response` header remains supported for backward compatibility. A wait timeout returns the same `202 Accepted` response as the default asynchronous invocation. Client request cancellation instead aborts the HTTP wait without returning a response, but the durable workflow continues; callers that need to recover should supply `runId` up front and query its status later.

In the function app logs, you will see the sequential execution of each executor:

```text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ Content-Type: text/plain

12345

### Cancel an order and wait for the result
POST {{authority}}/api/workflows/CancelOrder/run
### Cancel an order and wait for the result (plain-text response)
POST {{authority}}/api/workflows/CancelOrder/run?waitForResponse=true&timeoutSeconds=30
Content-Type: text/plain
x-ms-wait-for-response: true
Accept: text/plain

12345

### Cancel an order and wait for the result (JSON response)
POST {{authority}}/api/workflows/CancelOrder/run
### Cancel an order and wait for the result (default JSON response)
POST {{authority}}/api/workflows/CancelOrder/run?waitForResponse=true
Content-Type: text/plain
Accept: application/json
x-ms-wait-for-response: true

12345

Expand All @@ -35,9 +33,8 @@ Content-Type: text/plain
12345

### Get order status and wait for the result
POST {{authority}}/api/workflows/OrderStatus/run
POST {{authority}}/api/workflows/OrderStatus/run?waitForResponse=true
Content-Type: text/plain
x-ms-wait-for-response: true

12345

Expand Down
Loading
Loading