Change SaleCustomer
1 min
PUT
https://developer.digitail.io/api/v1/sale/{id}/customer
Body Parameters
- bodyobjectrequired
- customer_idintegerExampleDescription
Responses
200
- object
- dataobjectDescription
- idintegerExample
- namestringExample
- last_namestringExample
- emailstringExample
- phonestringExampleDescription
- addressstringExample
- citystringExample
- streetstringExample
- street_numberstringExample
- countrycountry
- zipstringExample
- regionstringExample
- timezonestringExample
- has_appbooleanExample
- chatUidstringExample
- vat_numberstringExampleDescription
- discountsitems[]
422
- undefinedExample
{ "message": "The client is not registered at the clinic this sale belongs to.", "errors": { "customer_id": [ "The client is not registered at the clinic this sale belongs to." ] } }
curl
curl --request PUT \
--url https://developer.digitail.io/api/v1/sale/{id}/customer \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'PUT',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://developer.digitail.io/api/v1/sale/{id}/customer", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://developer.digitail.io/api/v1/sale/{id}/customer")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://developer.digitail.io/api/v1/sale/{id}/customer"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
200
// successful operation
{
"data": {
"id": 1,
"name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone": "+16175551212.",
"address": "Flowers St. 300, Palo Alto, 123456, USA",
"city": "Palo Alto",
"street": "Flowers St.",
"street_number": "300",
"country": {},
"zip": "123456",
"region": "California",
"timezone": "America/Los_Angeles",
"has_app": true,
"chatUid": "e58ed763-928c-4155-bee9-fdbaaadc15f3",
"vat_number": "123456789",
"discounts": [
""
]
}
}422
// The customer is not a client of the sale's clinic, or the id does not exist
"{\"message\":\"The client is not registered at the clinic this sale belongs to.\",\"errors\":{\"customer_id\":[\"The client is not registered at the clinic this sale belongs to.\"]}}"