Call Requests - Example Usage

Overview

This guide provides practical examples of using the Call Requests API endpoints. Call requests allow customers to request a callback from your support team.

GET /api/2.0/call_requests/

Get All Call Requests

This endpoint retrieves a list of all call requests with their properties.

curl -X GET 'https://www.venddor.com.br/api/2.0/call_requests/'
Tip: You can use query parameters like status or date_range to filter the results.
GET /api/2.0/call_requests/{id}

Get a Specific Call Request

This endpoint retrieves a specific call request by its ID.

curl -X GET 'https://www.venddor.com.br/api/2.0/call_requests/1'

This example command returns the call request with the request_id=1 and all its properties.

POST /api/2.0/call_requests/

Create a New Call Request

This endpoint creates a new call request in the system.

Required Fields

At least one of the following is required: email or phone

Available Fields

Field Description Required
email Customer's email address Required if phone not provided
phone Customer's phone number Required if email not provided
name Customer's name Optional
time_from Preferred time to call (start) Optional
time_to Preferred time to call (end) Optional
user_id Associated user ID Optional
order_id Associated order ID Optional
product_id Associated product ID Optional
timestamp Time of the request Optional
status Current status of the call request Optional
notes Additional notes Optional
cart_products Products in customer's cart Optional
curl -H "Content-Type: application/json" -X POST https://www.venddor.com.br/api/2.0/call_requests -d '{"phone":"+7(999)111-22-33", "name":"John Doe", "time_from":"9:00", "time_to":"10:00"}'

This example creates a new call request from John Doe, who asks to be contacted between 9:00 and 10:00 at the specified phone number.

Sample Response

{request_id: 5}
PUT /api/2.0/call_requests/{id}/

Update a Call Request

This endpoint updates an existing call request in the system.

Available Fields

  • user_id - Associated user ID
  • order_id - Associated order ID
  • product_id - Associated product ID
  • status - Current status of the call request
  • notes - Additional notes
curl -H "Content-Type: application/json" -X PUT https://www.venddor.com.br/api/2.0/call_requests/5 -d '{"status":"no_answer", "notes":"John didn't answer the call"}'

This example updates the status of the call request with request_id=5 to "No Answer" and adds a corresponding note.

Sample Response

{request_id: 5}
DELETE /api/2.0/call_requests/{id}

Delete a Call Request

This endpoint deletes a specific call request from the system.

curl -X DELETE 'https://www.venddor.com.br/api/2.0/call_requests/5'

This example deletes the call request with request_id=5 from the system.

Response Status Codes

Status Code Description
204 No Content The call request has been deleted successfully.
400 Bad Request The call request couldn't be deleted.
404 Not Found The specified call request doesn't exist.
Important: Deleting a call request is permanent and cannot be undone. Make sure you have any necessary information before proceeding.