External feeds management
This document provides a descriptive view on the public API reference for the External feed endpoints.
1. Fetch all external feeds
To call this API, you need to request the endpoint https://api.brevo.com/v3/feeds with the GET method. This endpoint performs the function of retrieving all of your created external feeds. You can use the cURL request below:
curl --request GET \
--url 'https://api.brevo.com/v3/feeds?search=search&startDate=2022-09-04&endDate=2022-10-01&sort=desc&authType=basic&limit=50&offset=0' \
--header 'accept: application/json' \
--header 'api-key: '
The attributes used in the cURL request are defined below in a table.
| Attributes | Datatype | Description | Value |
|---|---|---|---|
search | String | Can be used to filter records by search keyword on feed name | search |
startDate | Date | Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. | 2022-09-04 |
endDate | Date | Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. | 2022-10-01 |
sort | String | Sort the results in the ascending/descending order of record creation. Default order is descending if sort is not passed. | desc |
authType | String | Filter the records by authType of the feed. (Has multiple authentication types) | basic |
limit | Int64 | Number of documents returned per page. | 50 |
offset | Int64 | Index of the first document on the page. | 0 |
Response
A sample JSON response for the request would be:
{
"count": 3,
"feeds": [
{
"id": "d955aaa4-f4d6-4557-aa14-24286542ed8d",
"name": "api feed token",
"url": "https://abc.com/",
"authType": "token",
"token": "jfhdkjdfhjkfdhjkdfhjkdfhkj",
"headers": [
{
"name": "key",
"value": "val"
}
],
"maxRetries": 4,
"cache": true,
"createdAt": "2022-10-06T05:03:47.053000000Z",
"modifiedAt": "2022-10-06T05:03:47.053000000Z"
},
{
"id": "311a71ac-bebc-42cf-963d-d8666dfe53e9",
"name": "api feed basic",
"url": "https://abc.com/",
"authType": "basic",
"username": "user",
"password": "pass",
"headers": null,
"maxRetries": 2,
"cache": false,
"createdAt": "2022-10-06T04:48:19.767000000Z",
"modifiedAt": "2022-10-06T04:48:19.767000000Z"
}
]
}
Some response codes are defined in the table below:
| Response code | Message | Description |
|---|---|---|
200 | External feeds | Displays the external feeds details |
400 | Invalid parameters passed | Error code occurs in case of failure by passing invalid parameters or out of range parameters etc. |
404 | Record not found | Error code is displayed in case the results or records are not found. This may occur due to an incorrect request etc. |
2. Create an external feed
To create an external feed, you need to call the endpoint https://api.brevo.com/v3/feeds with the POST method. You can use the cURL request below to send a request to the API.
curl --request POST \
--url https://api.brevo.com/v3/feeds \
--header 'accept: application/json' \
--header 'api-key: ' \
--header 'content-type: application/json' \
--data '
{
"authType": "basic",
"headers": [
{
"name": "userId",
"value": "user12345"
}
],
"maxRetries": 5,
"cache": false,
"name": "New feed",
"url": "http://requestb.in/173lyyx1",
"username": "user",
"password": "password",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
'
The values and attributes to create a feed are mentioned below in a table:
| Attribute | Datatype | Description | Value |
|---|---|---|---|
name | String | Name of the feed | New feed |
url | Url | URL of the feed | http://requestb.in/173lyyx1 |
authType | String | Auth type of the feed: basic, token or noAuth | basic |
username | String | Username for authType | user |
password | String | Password for authType | password |
token | String | Token for authType | "Random string of letters and number" |
headers | Array of objects | An array of objects which provide custom headers for the feed | it has objects name and value |
maxRetries | integer | Maximum number of retries on the feed url | 5 |
cache | boolean | Toggle caching of feed url response | false |
As headers is an array of objects, it has two more attributes name and value:
| Object | Datatype | Description | Value |
|---|---|---|---|
name | String | Name of the header | userId |
value | String | Value of the header | user12345 |
Response
When the request is run, the API will send you an id in the response which will be the unique id of the feed. A sample is given below:
{
"id": "23befbae-1505-47a8-bd27-e30ef739f32c"
}
The response codes are defined below:
| Response code | Message | Description |
|---|---|---|
201 | Successfully created | Successfully creates external feed and you get an id in the response which is id of the feed. |
400 | Bad request | Request fails due to invalid, missing parameters or an incorrect way of sending the request. |
3. Get an external feed by UUID
To send a request, you need to call the endpoint https://api.brevo.com/v3/feeds/{uuid} with the GET method. You can use the cURL request below:
curl --request GET \
--url https://api.brevo.com/v3/feeds/38f351fb-6e77-4b38-979a-a2465260449e \
--header 'accept: application/json' \
--header 'api-key: '
There is only one attribute which is uuid which is a universal identifier for the external feed. It is defined in the table below:
| Attribute | Datatype | Description | Value |
|---|---|---|---|
uuid | String | UUID of the feed to fetch | 38f351fb-6e77-4b38-979a-a2465260449e |
Response
{
"id": "d955aaa4-f4d6-4557-aa14-24286542ed8d",
"name": "api feed token",
"url": "https://abc.com/",
"authType": "token",
"token": "jfhdkjdfhjkfdhjkdfhjkdfhkj",
"headers": [
{
"name": "key",
"value": "val"
}
],
"maxRetries": 4,
"cache": true,
"createdAt": "2022-10-06T05:03:47.053000000Z",
"modifiedAt": "2022-10-06T05:03:47.053000000Z"
}
| Response code | Message | Description |
|---|---|---|
200 | External feeds | Displays the external fields details |
400 | Bad request | Error code occurs in case of a bad request by passing invalid parameters or out of range parameters etc. |
404 | Feed not found | Error code is displayed in case the results or feeds are not found. This may occur due to an incorrect request etc. |
4. Update an external feed
You can use this endpoint https://api.brevo.com/v3/feeds/{uuid} by calling the PUT method to update an external feed. You can use the cURL request below to send the request:
curl --request PUT \
--url https://api.brevo.com/v3/feeds/38f351fb-6e77-4b38-979a-a2465260449e \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"headers": [
{
"name": "userId",
"value": "user12345"
}
],
"maxRetries": 5,
"cache": false,
"name": "New feed",
"url": "http://requestb.in/173lyyx1",
"authType": "token",
"username": "user",
"password": "password",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
'
There are two types of parameters to update a field path params and body params which are mentioned below:
Path params
| Attribute | Datatype | Description | Value |
|---|---|---|---|
uuid | String | UUID of the feed to update | 38f351fb-6e77-4b38-979a-a2465260449e |
Body params
| Attribute | Datatype | Description | Value |
|---|---|---|---|
name | String | Name of the feed | New feed |
url | Url | Url of the feed | http://requestb.in/173lyyx1 |
authType | String | Auth type of the feed: basic, token, noAuth | token |
username | String | Username for authType basic | user |
password | String | Password for authType basic | password |
token | String | Token for authType token | Random numbers and letters |
headers | Array of objects | Custom headers for the feed | Contains objects name and value |
maxRetries | Integer | Maximum number of retries on the feed url | 5 |
cache | Boolean | Toggle caching of feed url response | false |
As headers is an array of objects, it contains two objects which are:
| Object | Datatype | Description | Value |
|---|---|---|---|
name | String | Name of header | userId |
value | String | Value of header | user12345 |
Response
A sample response would show no message but with a 204 response code which shows that the external feed has been updated. Below some of the response codes and their descriptions are mentioned:
| Response code | Message | Description |
|---|---|---|
204 | Feed updated | Feed is updated of the response code 204 is displayed. |
400 | Bad request | Bad request which fails the request due to bad or invalid parameters. |
404 | Feed not found | 404is displayed when the feed cannot be found maybe due to inputting the incorrect parameters or UUID. |
5. Delete an external feed
To delete a feed, you can call the endpoint https://api.brevo.com/v3/feeds/{uuid} with the DELETE method. For the deletion, you can make use of the cURL request below.
curl --request DELETE \
--url https://api.brevo.com/v3/feeds/38f351fb-6e77-4b38-979a-a2465260449e \
--header 'accept: application/json' \
--header 'api-key: '
Only uuid is used as an attribute and it is defined below.
| Attribute | Datatype | Description | Value |
|---|---|---|---|
uuid | String | UUID of the feed to fetch | 38f351fb-6e77-4b38-979a-a2465260449e |
Response
A sample JSON response would show nothing with the response code 200 which shows that the feed has been deleted.
Response codes for this endpoint are mentioned in the table.
| Response code | Message | Description |
|---|---|---|
200 | Feed deleted | Feed is deleted successfully. |
400 | Bad request | Bad request is sent to the API because of invalid or missing parameters |
404 | Feed not found | This response occurs when results or feeds are not found to be deleted. |
Updated almost 2 years ago
