Campaigns
Get all
- GET:
/v1/campaigns
Get all available campaigns
Example:
bash
curl https://doesangueapi.herokuapp.com/v1/campaigns
- Output
"current_page": 1,
"data": [
{
"id": 1,
"title": "Test publication",
"description": "This a test publication i have created to see how it works!",
"image": "",
"expires": "2017-12-31 00:00:00",
"owner": {
"first_name": "Test",
"last_name": "User",
"username": "testuser",
"bio": "I have no bio because i'm a test user!",
},
"comments": [
{
"id": 1,
"comment": "this is a comment on publication #1"
}
...
]
},
...
],
"from": 1,
"last_page": 1,
"next_page_url": null,
"path": "https://doesangueapi.herokuapp.com/v1/campaigns",
"per_page": "12",
"prev_page_url": null,
"to": 5,
"total": 5
}
Details
- GET:
/v1/campaigns/{id}
Get the campaign details by id
Params:
id
- The campign id (type: integer)
Example:
curl https://doesangueapi.herokuapp.com/v1/campaigns/1
- Output
{
"data": {
"title": "Test publication",
"owner": {
"first_name": "Test",
"last_name": "User",
"username": "testuser"
},
"dates": {
"start_at": "2017-08-29 06:08:39",
"finish_at": "2017-12-31 23:59:59"
}
}
}
Create
- POST:
/v1/campaigns
Params:
title
- The campign title (type: string)description
- The campign description (type: text)image
- The campign image (type: string)-
expires
- Expiration date for your campign (type: datetime, format:Y-m-d H:m:s
) -
Header
"Content-Type: application/json"
- Type/structure of data you are sending"Authorization: Bearer token"
- Authentication token
Example:
curl https://doesangueapi.herokuapp.com/v1/campaigns/ -d '{"title: "Other test publication", "description": "Because we are always testing this, i have created just a basic campaign!", "image": "https://assets.doesangue.me/images/campaigns/test.png", "expires": "20190405 20:30:00"}' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_LONG_TOKEN_HERE"
- Output
{
"status_code": 201,
"message": "Campaign added!"
}