RTyy / aiocomments

Comments Service Based on aiohttp
0 stars 0 forks source link

Make create comment method #6

Open RTyy opened 7 years ago

RTyy commented 7 years ago

An author (user_id), service_id and service_type will be provided within the request(json) as integer values.

Request:

{
  "user_id": user_id,
  "itype_id": instance_type_id,  # 0 or unspecified means "comment"
  "i_id": instance_id,
  "content": comment_content,
}
curl -i -X PUT -H "Content-Type: application/json" -d "{creat_comment_json_data}" http://local.server.com/api/comment/

Responses:

On Success Status Code: 200

{
  "id": comment_id,
  "user_id": author_id,
  "itype_id": instance_type_id,  # 0 or unspecified means "comment"
  "i_id": instance_id,
  "content": comment_content,
  "created": comment_create_date,
  "updated": comment_update_date,
}

On Error Status Code: 400, 403, 404

{
  "error": error_title,
  "data_errors": {
     "var_name": error_code,
     ...
  }
}
RTyy commented 7 years ago

1h