Search.../

created( )

Returns a response with status code 201 (Created) and the information from the options parameter.

Description

The created() function creates a response with the status code 201 (Created).

Optionally, the created() function can take a WixHttpFunctionResponseOptions object which is used to specify the response's body and headers.

Note: If the object contains a status it will be ignored.

Use the created() function to create a response to return from an HTTP function. A 201 (Created) response is usually used to indicate that the request was successful and a new resource has been created.

Authorization

Request

This endpoint does not take any parameters

Response Object

Returns an empty object.

Status/Error Codes

Was this helpful?

Create a 201 (Created) response

Copy Code
1// In http-functions.js
2
3import {created} from 'wix-http-functions';
4
5export function use_myFunction(request) {
6
7 return created();
8}
Create a 201 (Created) response

Copy Code
1// In http-functions.js
2
3import {created} from 'wix-http-functions';
4
5export function use_myFunction(request) {
6
7 let options = {
8 body: {
9 "key1": "value1",
10 "key2": "value2"
11 },
12 headers: {
13 "Content-Type": "application/json"
14 }
15 };
16
17 return created(options);
18}