PUT /customers/:id
Updates an already existing customer information.
This request is idempotent.
curl -XPUT \
--header "Content-Type: application/json" \
--header "Authorization: Bearer 4b1e8df2ff50110ca86e28f2b499facbd78310c9cda0125543ad80ac70cc28d1" \
https://api.invisiblecollector.com/customers/061d2feb-81c2-4694-a74a-13cecbe7d2ce \
--data '...'
require "net/https"
require "uri"
require "json"
uri = URI.parse("https://api.invisiblecollector.com/customers/2134235")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer 4a415cc660e67d8f4d26d5a7f390183a86fc3a4524ded78dc2448e86c48b2739'
request.body = data.to_json
response = http.request(request)
import com.ic.invisiblecollector.IcApiFacade;
import com.ic.invisiblecollector.model.Customer;
IcApiFacade apiFacade = new IcApiFacade("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
Customer aNewCustomer = new Customer();
... // set customer info, including mandatory fields and an id or externalId
Customer createdCustomer = apiFacade.updateCustomerInfo(customer);
using InvisibleCollectorLib;
using InvisibleCollectorLib.Model;
var ic = new InvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
var modifiedCustomer = new Customer() {
// set the custoemr fields to modify, including the mandatory ones
//important to have AT LEAST ONE of these SET (both string)
Gid = theCustomerId // the one returned by a get request
ExternalId = internalCustomerId
};
Customer updatedCustomer = await ic.SetCustomerInfoAsync(modifiedCustomer);
iC, err := ic.NewInvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98", ic.InvisibleCollectorUri)
model := ic.MakeCustomer()
// set id to identify customer
model.SetId("54cff32c-f078-4ca5-a2bd-bd8e1bf23973")
// or
model.SetExternalId("1234")
... // set other fields including the mandatory ones
var channel = make(chan ic.CustomerPair)
go iC.SetCustomer(channel, model)
p := <-channel
fmt.Println(p.Customer)
This request can receive, for example, the following JSON data:
{
"name": "John Doe Inc.",
"externalId": "123",
"vatNumber": "PT543219876",
"address": "Invisible Avenue, 456",
"zipCode": "1234-543",
"city": "Lisbon",
"country": "PT",
"email": "[email protected]",
"phone": "55598745",
"locale": "pt"
}
This request will return, for example, the following JSON response:
{
"name": "John Doe Inc.",
"externalId": "123",
"vatNumber": "PT543219876",
"address": "Invisible Avenue, 456",
"zipCode": "1234-543",
"city": "Lisbon",
"country": "PT",
"email": "[email protected]",
"phone": "55598745",
"gid": "061d2feb-81c2-4694-a74a-13cecbe7d2ce",
"locale": "pt"
}
Endpoint
PUT https://api.invisiblecollector.com/customers/:id
Request body
Attribute | Type | Mandatory | Default | Description |
---|---|---|---|---|
name | string | no | N/A | The name of this customer. |
externalId | string | no | N/A | An external identification of this customer. Mainly used to facilitate integration with external systems. |
vatNumber | string | no | N/A | The customer’s unique identification number for tax purposes. |
address | string | no | N/A | The customer’s address. |
zipCode | string | no | N/A | The customer’s zip code. |
city | string | no | N/A | The customer’s city. |
country | string | yes | N/A | The customer’s ISO 3166-1 country code. |
string | no | N/A | The customer’s email address. Will be used as the destination for email notifications. | |
phone | string | no | N/A | The customer’s phone number. Will be used as the destination for SMS and VMS notifications. |
locale | string | no | “pt” | The customer’s locale. Only "pt", "es", "en", "fr-fr", "de", "zh-CN" are accepted. Will be used to set the language of notifications sent to the customer. |
Response body
Attribute | Type | Description |
---|---|---|
name | string | The name of this customer. |
externalId | string | An external identification of this customer. Mainly used to facilitate integration with external systems. |
vatNumber | string | The customer’s unique identification number for tax purposes. |
address | string | The customer’s address. |
zipCode | string | The customer’s zip code. |
city | string | The customer’s city. |
country | string | The customer’s ISO 3166-1 country code. |
string | The customer’s email address. Will be used as the destination for email notifications. | |
phone | string | The customer’s phone number. Will be used as the destination for SMS and VMS notifications. |
gid | string | An unique identifier of this customer which can be used to retrive it. |
locale | string | The customer’s locale. Will be used to set the language of notifications sent to the customer. |
Errors
This endpoint may return the following errors
HTTP Code | Description |
---|---|
401 Unauthorized | Invalid credentials were supplied |
422 Unprocessable Entity | The request is syntactically correct but not a valid document JSON object or one the sanity checks failed |