Skip to content

Commit 46a3316

Browse files
Add request payload section
1 parent 3ef893d commit 46a3316

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

articles/azure-functions/functions-custom-handlers.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,61 @@ When used with a custom handler, the *function.json* contents are no different f
113113

114114
### Request payload
115115

116-
todo
116+
The request payload for pure HTTP functions is the raw HTTP request payload. Pure HTTP functions are defined as functions with no input or output bindings, that return an HTTP response.
117+
118+
Any other type of function that includes either input, output bindings or is triggered via an event source other than HTTP have a custom request payload.
119+
120+
The following code represents a sample request payload. The payload includes a JSON payload with two members: `Data` and `Metadata`.
121+
122+
The `Data` member includes keys that match input and trigger names as defined in the bindings array in the *function.json* file.
123+
124+
The `Metadata` member includes [metadata generated from the event source](./functions-bindings-expressions-patterns.md#trigger-metadata).
125+
126+
Given the bindings defined in the following *function.json* file:
127+
128+
```json
129+
{
130+
"bindings": [
131+
{
132+
"name": "myQueueItem",
133+
"type": "queueTrigger",
134+
"direction": "in",
135+
"queueName": "messages-incoming",
136+
"connection": "AzureWebJobsStorage"
137+
},
138+
{
139+
"name": "$return",
140+
"type": "queue",
141+
"direction": "out",
142+
"queueName": "messages-outgoing",
143+
"connection": "AzureWebJobsStorage"
144+
}
145+
]
146+
}
147+
```
148+
149+
A request payload similar to this example is returned:
150+
151+
```json
152+
{
153+
"Data": {
154+
"myQueueItem": "{ message: \"Message sent\" }"
155+
},
156+
"Metadata": {
157+
"DequeueCount": 1,
158+
"ExpirationTime": "2019-10-16T17:58:31+00:00",
159+
"Id": "800ae4b3-bdd2-4c08-badd-f08e5a34b865",
160+
"InsertionTime": "2019-10-09T17:58:31+00:00",
161+
"NextVisibleTime": "2019-10-09T18:08:32+00:00",
162+
"PopReceipt": "AgAAAAMAAAAAAAAAAgtnj8x+1QE=",
163+
"sys": {
164+
"MethodName": "QueueTrigger",
165+
"UtcNow": "2019-10-09T17:58:32.2205399Z",
166+
"RandGuid": "24ad4c06-24ad-4e5b-8294-3da9714877e9"
167+
}
168+
}
169+
}
170+
```
117171

118172
### Response payload
119173

@@ -385,8 +439,9 @@ A custom handler can be deployed to any Azure Functions hosting option. If your
385439

386440
## Restrictions
387441

388-
Custom handlers are not supported in Linux consumption plans.
442+
- Custom handlers are not supported in Linux consumption plans.
443+
- Web servers needs to start within 60 seconds
389444

390445
## Samples
391446

392-
Refer to the custom handler samples GitHub repo for examples of how to implement functions in a variety of different languages.
447+
Refer to the [custom handler samples GitHub repo](https://github.com/pragnagopa/functions-http-worker) for examples of how to implement functions in a variety of different languages.

0 commit comments

Comments
 (0)