RTyy / aiocomments

Comments Service Based on aiohttp
0 stars 0 forks source link

Make edit(update) comment method #7

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:

"id", comment_id,  # id of the comment that should be updated,
{
  "user_id": user_id,
  "content": new_comment_content,
}
curl -i -X POST -H "Content-Type: application/json" -d "{update_comment_json_data}" http://local.server.com/api/comment/{id}/

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