Introduction
Welcome to the API! If you find someting wrong, you can open a issue on the github.
Explain
Authentication
Almost all API requests require authentication. You need to pass a private_token
parameter by URL or header. If passed as header, the header name must be “PRIVATE-TOKEN” (capital and with dash instead of underscore).
If no, or an invalid, private_token
is provided then an error message will be returned with status code 401:
{ "message": "401 Unauthorized" }
Example of a valid API request:
GET http://beta.ideaegg.me/api/v2/ideas?private_token=QVy1PB7sTxfy4pqfZM1U
Example for a valid API request using curl and authentication via header:
curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://beta.ideaegg.me/api/v2/ideas"
Pagination
GET /api/v1/ideas?page=2&per_page=10 HTTP/1.1
PRIVATE-TOKEN: your_private_token
When listing resources you can pass the following parameters:
-
page
(default:1
) - page number -
per_page
(default:24
, max:100
) - number of items to list per page
Sessions
Sign up
Sign up to register new user
POST /sign_up HTTP/1.1
Content-Type: application/json
{
"username": "john_smith",
"email": "john@example.com",
"password": "test1234",
"password_confirmation": "test1234"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"username": "john_smith",
"email": "john@example.com",
"fullname": "john_smith",
"private_token": "dd34asd13as",
"created_at": "2012-05-23T08:00:58Z"
}
POST /sign_up
Parameters
Name | Type | Description |
---|---|---|
username | string | Required.The username of user |
string | Required.The email of user | |
password | string | Required.User password |
password_confirmation | string | Required. User password confirmation |
Sign in
Sign in to get private token
POST /sign_in HTTP/1.1
Content-Type: application/json
{
"login": "john@example.com",
"password": "test1234"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"username": "john_smith",
"email": "john@example.com",
"fullname": "john_smith",
"private_token": "dd34asd13as",
"created_at": "2012-05-23T08:00:58Z"
}
POST /sign_in
Parameters
Name | Type | Description |
---|---|---|
login | string | Required.The login of user: username or email |
password | string | Required.Valid password |
Sign in with wechat
POST /sign_in_with/wechat HTTP/1.1
Content-Type: application/json
{
"uid": "test_uid",
"username": "cb41b7b2",
"email": "cb41b7b2@ideaegg.me",
"fullname": "cb41b7b2",
"avatar": "www.test.com/test.png",
"phone_number": "13800000000"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 14,
"username": "cb41b7b2",
"email": "cb41b7b2@ideaegg.me",
"fullname": "cb41b7b2",
"private_token": "CFRcLE-N9YxgpFxKpngz",
"created_at": "2015-06-06T14:20:57.024Z",
"avatar": "www.test.com/test.png",
"phone_number": "13800000000"
}
POST /sign_in_with/wechat
Parameters
Name | Type | Description |
---|---|---|
uid | string | Required.The openid of wechat |
username | string | Optional. The username of user.if no, the endpoint will generates one |
string | Optional. The email of user.if no, the endpoint will generates one | |
avatar | string | Optional. The avatar of user. |
fullname | string | Optional. The fullname of user.if no, the endpoint will generates one according to username |
phone_number | string | Optional. The phone_number of user. |
Reset password
Reset password by email if the user forgets password
POST /reset_password HTTP/1.1
Content-Type: application/json
{
"email": "test@qq.com"
}
HTTP/1.1 204 OK
POST /reset_password
Parameters
Name | Type | Description |
---|---|---|
string | Required. Email of the user |
Sign up temporarily
A key to log in
POST /sign_up_temporarily` HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 12,
"username": "0c60b755",
"email": "0c60b755@ideaegg.me",
"fullname": "0c60b755",
"private_token": "focmQrCFdk9DJHx9KvdL",
"created_at": "2015-07-30T05:28:58.421Z"
}
POST /sign_up_temporarily
Parameters
- None
Ideas
List ideas
Get a list of ideas by the authenticated user.
GET /ideas HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 OK
Link: <http://localhost:3000/api/v2/ideas?page=1&per_page=24>;rel="first",
<http://localhost:3000/api/v2/ideas?page=1&per_page=24>; rel="last"
Content-Type: application/json
[
{
"id": 6,
"title": "test-title",
"cover": null,
"summary": "test-summary",
"content": "test-content",
"content_html": "<p>test-content</p>\ ",
"stars_count": 0,
"comments_count": 0,
"votes_count": 0,
"author": {
"id": 11,
"username": "8ac89167",
"email": "8ac89167@ideaegg.me",
"fullname": "8ac89167",
"created_at": "2015-06-06T02:50:30.447Z",
"phone_number": null,
"avatar": null
},
"tags": []
},
{
"id": 5,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Sirloin leberkas doner pork loin strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>\ ",
"stars_count": 10,
"comments_count": 1,
"votes_count": 10,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
]
GET /ideas
or GET /ideas?tag=foo
parameters
Name | Type | Description |
---|---|---|
tag | string | Optional.Inquire ideas by tag |
Get an idea by id
Get a specific idea, identified by idea ID.
GET /ideas/1 HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 1,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Turkey doner bacon capicola salami strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>\\\n",
"comments_count": 1,
"stars_count": 10,
"votes_count": 10,
"starred": false,
"voted": false,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-08-09T01:20:55.119Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
GET /ideas/:id
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required.The id of an idea |
Create idea
Creates a new idea owned by the authenticated user.
POST /ideas HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"title": "test-title",
"summary": "test-summary",
"content": "test-content",
"cover": "http://qiniu.com/test"
}
HTTP/1.1 201 created
Content-Type: application/json
{
"id": 6,
"title": "test-title",
"cover": "http://qiniu.com/test",
"summary": "test-summary",
"content": "test-content",
"content_html": "<p>test-content</p>\ ",
"stars_count": 0,
"comments_count": 0,
"votes_count": 0,
"author": {
"id": 11,
"username": "8ac89167",
"email": "8ac89167@ideaegg.me",
"fullname": "8ac89167",
"created_at": "2015-06-06T02:50:30.447Z",
"phone_number": null,
"avatar": null
},
"tags": [ ]
}
POST /ideas
Parameters
Name | Type | Description |
---|---|---|
title | string | Required. new idea title |
content | string | Required. new idea content |
summary | string | Required. new idea summary |
cover | string | Optional. new idea cover |
tag | string | Optional. add tags for the idea. eg. “tag1,tag2” |
Update idea
Update an idea’s title or content owned by the authenticated user.
PUT /ideas/1 HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"title": "test-title2",
"summary": "test-summary2",
"content": "test-content2",
"cover": "http://qiniu.com/test2"
}
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 1,
"title": "test-title2",
"cover": "http://qiniu.com/test2",
"summary": "test-summary2",
"content": "test-content2",
"content_html": "<p>test-content2</p>\n ",
"stars_count": 10,
"comments_count": 1,
"votes_count": 11,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
PUT /ideas/:id
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
title | string | Required. new title |
content | string | Required. new content |
summary | string | Required. new summary |
cover | string | Optional. new cover |
Delete idea
Delete an idea owned by the authenticated user.
DELETE /ideas/4 HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 204 no content
DELETE /ideas/:id
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
Like idea
Like an idea by the authenticated user.
PUT /ideas/1/vote HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 1,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Sirloin leberkas doner pork loin strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>\ ",
"stars_count": 10,
"comments_count": 1,
"votes_count": 11,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
PUT /ideas/:id/vote
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
Unlike idea
Unlike an idea by the authenticated user.
DELETE /ideas/1/vote HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 1,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Sirloin leberkas doner pork loin strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>\ ",
"stars_count": 10,
"comments_count": 1,
"votes_count": 10,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
DELETE /ideas/:id/vote
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
Star idea
Star an idea by the authenticated user.
PUT /ideas/1/star HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 1,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Sirloin leberkas doner pork loin strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>\ ",
"stars_count": 11,
"comments_count": 1,
"votes_count": 10,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
PUT /ideas/:id/star
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
Unstar idea
Unstar an idea by the authenticated user.
DELETE /ideas/1/star HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 1,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Sirloin leberkas doner pork loin strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>\ ",
"stars_count": 10,
"comments_count": 1,
"votes_count": 10,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
DELETE /ideas/:id/star
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
Tag idea
Tag an idea by the authenticated user.
POST /ideas/8/tags HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"tag": "tag1, tag2"
}
HTTP/1.1 200 ok
Content-Type: application/json
[
{
"id": 4,
"name": "test",
"taggings_count": 1
},
{
"id": 5,
"name": "test2",
"taggings_count": 1
},
{
"id": 6,
"name": "tag1",
"taggings_count": 1
},
{
"id": 7,
"name": "tag2",
"taggings_count": 1
}
]
POST /ideas/:id/tags
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
tag | string | Required. tags, splitted by ’,’ such as ‘software’ or ‘software, children’ |
Untag idea
Untag an idea by the authenticated user.
POST /ideas/8/untags HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"tag": "tag1, tag2"
}
HTTP/1.1 200 ok
Content-Type: application/json
[
{
"id": 4,
"name": "test",
"taggings_count": 1
},
{
"id": 5,
"name": "test2",
"taggings_count": 1
}
]
POST /ideas/:id/untags
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
tag | string | Required. tags, splitted by ’,’ such as 'software’ or 'software, children’ |
Get a idea’s comments
Return the comments ordered by created time
GET /ideas/1/comments HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
Link: <http://localhost:3000/api/v2/ideas/1/comments?page=1&per_page=24>; rel="first",
<http://localhost:3000/api/v2/ideas/1/comments?page=1&per_page=24>; rel="last"
[
{
"id": 1,
"body": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
"body_html": "<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>\ ",
"created_at": "2015-06-06T02:20:54.174Z",
"idea_id": 1,
"user": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
}
}
]
GET /ideas/:id/comments
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
Make a comment on the idea
POST /ideas/1/comments HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"body": "this is a body"
}
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 7,
"body": "test",
"body_html": "<p>test</p>\ ",
"created_at": "2015-06-08T01:15:58.530Z",
"idea_id": 1,
"user": {
"id": 11,
"username": "8ac89167",
"email": "8ac89167@ideaegg.me",
"fullname": "8ac89167",
"created_at": "2015-06-06T02:50:30.447Z",
"phone_number": null,
"avatar": null
}
}
POST /ideas/:id/comments
Parameters
Name | Type | Description |
---|---|---|
id | integer | Required. id of the idea |
body | string | Required. content of the comment |
Users
Get current user
Get self user
GET /user HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 15,
"username": "testtest",
"email": "test@qq.com",
"fullname": "testtest",
"created_at": "2015-05-23T01:27:56.015Z",
"phone_number": null,
"avatar": null,
"private_token": "WwUD85zhd_kMEurVu7SE"
}
GET /user
Parameters
- None
Update user
Update a user’s avatar, fullname or phone_number by the authenticated user.
PUT /user HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"email": "new_email@qq.com",
"fullname": "test-fullname",
"avatar": "http://qiniu.com/test",
"phone_number": "13800000000"
}
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 15,
"username": "testtest",
"email": "new_email@qq.com",
"fullname": "test-fullname",
"created_at": "2015-05-23T01:27:56.015Z",
"phone_number": "13800000000",
"avatar": "http://qiniu.com/test",
"private_token": "WwUD85zhd_kMEurVu7SE"
}
PUT /user
Parameters
Name | Type | Description |
---|---|---|
string | Required. new email | |
fullname | string | Required. new fullname |
phone_number | string | Optional. phone number |
avatar | string | Optional. avatar url |
Follow user
Follow another user by the authenticated user.
POST /users/2/follow HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
POST /users/:id/follow
Name | Type | Description |
---|---|---|
id | integer | Required. The id of a user that will be followed |
Unfollow user
Unfollow another user by the authenticated user.
DELETE /users/2/follow HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 ok
DELETE /users/:id/follow
Name | Type | Description |
---|---|---|
id | integer | Required. The id of a user that will be unfollowed |
Get my ideas
Get current user’s ideas.
GET /user/ideas/created HTTP/1.1
PRIVATE-TOken: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
Link: <http://localhost:3000/api/v2/user/ideas/created?page=1&per_page=24>; rel="first",
<http://localhost:3000/api/v2/user/ideas/created?page=1&per_page=24>; rel="last"
[
{
"id": 8,
"title": "test-title",
"cover": null,
"summary": "test-summary",
"content": "test-content",
"stars_count": 0,
"comments_count": 0,
"votes_count": 0,
"author": {
"id": 11,
"username": "8ac89167",
"email": "8ac89167@ideaegg.me",
"fullname": "8ac89167",
"created_at": "2015-06-06T02:50:30.447Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 4,
"name": "test",
"taggings_count": 1
},
{
"id": 5,
"name": "test2",
"taggings_count": 1
}
]
}
]
GET /user/ideas/voted
Parameters
- None
Get my liked ideas
Get current user’s liked ideas.
GET /user/ideas/voted HTTP/1.1
PROVIATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
Link: <http://localhost:3000/api/v2/user/ideas/voted?page=1&per_page=24>; rel="first",
<http://localhost:3000/api/v2/user/ideas/voted?page=1&per_page=24>; rel="last"
[
{
"id": 1,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Sirloin leberkas doner pork loin strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>",
"stars_count": 11,
"comments_count": 2,
"votes_count": 11,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
]
GET /user/ideas/voted
Parameters
- None
Get my starred ideas
Get current user’s starred ideas.
GET /user/ideas/starred HTTP/1.1
PROVIATE-TOKEN: your_private_token
HTTP/1.1 200 ok
Content-Type: application/json
Link: <http://localhost:3000/api/v2/user/ideas/starred?page=1&per_page=24>; rel="first",
<http://localhost:3000/api/v2/user/ideas/starred?page=1&per_page=24>; rel="last"
[
{
"id": 1,
"title": "Hello",
"cover": "http://test_image/test.png",
"summary": "Sirloin leberkas doner pork loin strip steak.",
"content": "**World**",
"content_html": "<p><strong>World</strong></p>",
"stars_count": 11,
"comments_count": 2,
"votes_count": 11,
"author": {
"id": 1,
"username": "johndoe1",
"email": "john1@ideaegg.me",
"fullname": "John Doe",
"created_at": "2015-06-06T02:20:40.292Z",
"phone_number": null,
"avatar": null
},
"tags": [
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
}
]
GET /user/ideas/starred
Parameters
- None
Modify password
modify password by current password
PUT /user/password HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"current_password": "test_password",
"password": "new_password",
"password_confirmation": "new_password"
}
HTTP/1.1 200 ok
Content-Type: application/json
{
"id": 15,
"username": "testtest",
"email": "test@qq.com",
"fullname": "testtest",
"created_at": "2015-05-23T01:27:56.015Z",
"phone_number": null,
"avatar": null,
"private_token": "WwUD85zhd_kMEurVu7SE"
}
PUT /user/password
Parameters
Name | Type | Description |
---|---|---|
current_password | string | Required. currnet password of the user |
password | string | Required. new password of the user |
password_confirmation | string | Required. new password confirmation |
Tags
List tags
Paging list the tags ordered by number of use
GET /tags HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 OK
Link: <http://localhost:3000/api/v2/tags?page=1&per_page=24>; rel="first",
<http://localhost:3000/api/v2/tags?page=1&per_page=24>; rel="last"
Content-Type: application/json
[
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
},
{
"id": 2,
"name": "test_tag2",
"taggings_count": 5
}
]
GET /tags
parameters
- None
Query tags
query tags by the name, results will be paging listed
GET /tags/query?name=tag1 HTTP/1.1
PRIVATE-TOKEN: your_private_token
HTTP/1.1 200 OK
Link: <http://localhost:3000/api/v2/tags/query?page=1&per_page=24>; rel="first",
<http://localhost:3000/api/v2/tags/query?page=1&per_page=24>; rel="last"
Content-Type: application/json
[
{
"id": 1,
"name": "test_tag1",
"taggings_count": 5
}
]
GET /tags/query
parameters
Name | Type | Description |
---|---|---|
name | string | Required. name of the tag |
Markdown
Convert markdown into html
POST /markdown/preview HTTP/1.1
PRIVATE-TOKEN: your_private_token
Content-Type: application/json
{
"content": "## title"
}
HTTP/1.1 200 ok
Content-Type: application/json
{
"content": "<h2>title</h2>\n"
}
POST /markdown/preview
Parameters
Name | Type | Description |
---|---|---|
content | string | Required. the content that is converted into html |
Feedback
create a feedback
POST /products/1/feedbacks HTTP/1.1
PRIVATE-TOKEN: your_private_token
{
"body": "this is a body",
"stars": 5,
"images": [
"www.baidu.com/picture.png",
" www.test.com/image.png"
],
"contact": "xx@qq.com",
"anonymous": false
}
HTTP/1.1 201 OK
Content-Type: application/json
{
"id": 4,
"body": "this is a body",
"stars": 5,
"images": [
"www.baidu.com/picture.png",
" www.test.com/image.png"
],
"contact": "xx@qq.com",
"anonymous": false,
"product": {
"id": 1,
"name": "test_name"
}
}
POST /products/:id/feedbacks
Parameters
Name | Type | Description |
---|---|---|
body | string | Required. body of feedback |
stars | integer | Required. stars of feedback(value in 0-5) |
images | array | Optional. images of feedback |
contact | string | Optional. user contact |
anonymous | boolean | Optional. if anonymous |
Errors
The API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request – Your request sucks |
401 | Unauthorized – Your private token is wrong |
403 | Forbidden – The request is without permission |
404 | Not Found – The requested resource does not exist |
422 | Unprocessable – Fail to validate |
500 | Internal Server Error – We had a problem with our server. Try again later. |
503 | Service Unavailable – We’re temporarially offline for maintanance. Please try again later. |