GET /customers/:id/attributes
Returns a map with custom attributes assigned to the specified customer.
The provided id can be either:
- The global id Invisible Collector assigned to the customer when it was first registered;
- The external id provided by the client upon registration.
curl -XGET \
--header "Content-Type: application/json" \
--header "Authorization: Bearer 795d966936e24e19d4f9455be5ce44a4fd1d489623b966d20acf53ac0994cdfa" \
https://api.invisiblecollector.com/customers/2314234/attributes
require "net/https"
require "uri"
uri = URI.parse("https://api.invisiblecollector.com/customers/2314234/attributes")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer 4a415cc660e67d8f4d26d5a7f390183a86fc3a4524ded78dc2448e86c48b2739'
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 the customer id or externalId
Map<String, String> customerAttributes = apiFacade.requestCustomerAttributes(customer);
//or
String customerId = ...
Map<String, String> customerAttributes = apiFacade.requestCustomerAttributes(customerId);
using InvisibleCollectorLib;
using InvisibleCollectorLib.Model;
var ic = new InvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
string customerId = ... ;
IDictionary<string, string> customerAttributes = await ic.GetCustomerAttributesAsync(customerId);
iC, err := ic.NewInvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98", ic.InvisibleCollectorUri)
var channel = make(chan ic.AttributesPair)
go iC.GetCustomerAttributes(channel, aCustomerModel.Id())
p := <-channel
fmt.Println(p.Attributes)
This request returns the following JSON response:
{
"name_1": "attribute_1",
"name_2": "attribute_2"
}
Endpoint
GET https://api.invisiblecollector.com/customers/:id/attributes
Errors
This endpoint may return the following errors
HTTP Code | Description |
---|---|
401 Unauthorized | Invalid credentials were supplied |
404 Not found | The user doesn’t have any customer registered with that specific id. |