Discussions API Example Usage

Discussions API Endpoints

The Discussions API allows you to manage reviews and comments in your store. This guide provides examples for each endpoint with sample requests and responses.

Base URL: https://www.venddor.com.br/api/2.0
GET /discussions

Retrieves a list of reviews and comments with their properties.

Example Request

curl -X GET 'https://www.venddor.com.br/api/2.0/discussions/'
Note: This endpoint returns all reviews and comments in your store. Use pagination parameters to limit the number of results.
GET /discussions/:id

Retrieves details of a specific review or comment by its ID.

Path Parameters

Parameter Type Description
id* integer The unique identifier of the review or comment

Example Request

curl -X GET 'https://www.venddor.com.br/api/2.0/discussions/18'
Info: This example retrieves the review or comment with post_id=18.
POST /discussions

Creates a new review or comment in the system.

Request Fields

Required fields: object_type + object_id or thread_id

Available fields: object_type, object_id, thread_id, name, message, rating_value, timestamp, status

Response Status Codes

Status Code Description
201 Created Review or comment created successfully
400 Bad Request Invalid request parameters

Example Request

curl -H "Content-Type: application/json" -X POST https://www.venddor.com.br/api/2.0/discussions -d '{"object_type":"P", "object_id":242, "name":"John Doe", "rating_value":4, "message":"Hi, I use the API!"}'

This example creates a product review from John Doe for the product with product_id=242. The rating is 4 out of 5 stars, and the message is "Hi, I use the API!".

Example Response

{
  "post_id": 22
}
Tip: The response includes the ID of the newly created review or comment, which you can use to reference it in future API calls.
PUT /discussions/:id

Updates an existing review or comment with new properties.

Path Parameters

Parameter Type Description
id* integer The unique identifier of the review or comment to update

Available Fields

name, message, rating_value, timestamp, status

Example Request

curl -H "Content-Type: application/json" -X PUT https://www.venddor.com.br/api/2.0/discussions/22 -d '{"rating_value":5, "message":"Changed message via API", "status":"D"}'

This example updates the review or comment with post_id=22. It changes the rating_value to 5, modifies the message to "Changed message via API", and sets the status to disapproved.

Example Response

{
  "post_id": 22
}
DELETE /discussions/:id

Deletes a specific review or comment from the system.

Path Parameters

Parameter Type Description
id* integer The unique identifier of the review or comment to delete

Response Status Codes

Status Code Description
204 No Content Review or comment deleted successfully
400 Bad Request Review or comment couldn't be deleted
404 Not Found Review or comment doesn't exist

Example Request

curl -X DELETE 'https://www.venddor.com.br/api/2.0/discussions/22'

This example deletes the review or comment with post_id=22.

Warning: Deleting a review or comment is permanent and cannot be undone. Consider changing the status to disapproved instead of deleting if you want to hide it from customers.