Requests
Perform GET, POST, PUT, and DELETE operations on API objects
Below are the HTTP methods for performing requests on the API objects. Requests can be executed
on a single or list of known objects by their object id, or a group of objects based on query
parameters by using Conditional Queries.
| Method | Description | Example |
|---|---|---|
GET | Select one or many objects | GET /transactions |
POST | Create one or many objects | POST /transactions |
PUT | Update one or many objects | PUT /transactions |
DELETE | Delete one or many objects | DELETE /transactions |
Selecting Objects
Select individual or multiple objects using the HTTP method GET.
Request: GET https://api.payload.com/transactions/{id}
Request Multiple Objects: GET https://api.payload.com/transactions/?attr=value
Filter results using conditional queries.
Creating Objects
Create individual or multiple objects using the HTTP method POST.
Create Request: POST https://api.payload.com/customers
Request Body:
{
"email": "[email protected]",
"name": "Matt Perez"
}Create Multiple Objects: POST https://api.payload.com/customers
Request Body:
{
"object": "list",
"values": [
{
"email": "[email protected]",
"name": "Matt Perez"
},
{
"email": "[email protected]",
"name": "Matt Perez"
}
]
}Updating Objects
Update individual or multiple objects using the HTTP method PUT.
Update Request: PUT https://api.payload.com/customers/{id}
Request Body:
{
"email": "[email protected]"
}Update Query:
PUT https://api.payload.com/customers/[email protected]&mode=query
Request Body:
{
"email": "[email protected]"
}When performing updates by query, it is required to include the mode=query flag. This flag
is a safety feature implemented to prevent accidental bulk updates when a select operation was
intended instead.
Update Multiple Objects: PUT https://api.payload.com/customers
Request Body:
{
"object": "list",
"values": [
{
"id": "acct_3bW9JN4OEmUpEezSq6TJY",
"email": "[email protected]"
},
{
"id": "acct_3bW9JN4OmbDd2Kg8bdK4W",
"email": "[email protected]"
}
]
}Deleting Objects
Delete individual or multiple objects using the HTTP method DELETE.
Delete Request: DELETE https://api.payload.com/customers/{id}
Delete Query:
DELETE https://api.payload.com/customers/[email protected]&mode=query
When performing deletes by query, it is required to include the mode=query flag. This flag
is a safety feature implemented to prevent accidental bulk deletes when a select operation was
intended instead.
Delete Multiple Objects: DELETE https://api.payload.com/customers
Request Body:
{
"object": "list",
"values": [
{
"id": "acct_3bW9JN4OEmUpEezSq6TJY"
},
{
"id": "acct_3bW9JN4OmbDd2Kg8bdK4W"
}
]
}