POST /groups/{groupId}/customers/{customerId}
Add a customer to a group.
This request associates a customer with a specified group in the context of the authenticated company.
If the group or customer does not exist, a 404 Not Found
status code will be returned.
curl -XPOST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer your_api_token_here" \
https://api.invisiblecollector.com/groups/{groupId}/customers/{customerId}
require "net/https"
require "uri"
require "json"
uri = URI.parse("https://api.invisiblecollector.com/groups/#{groupId}/customers/#{customerId}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer your_api_token_here'
response = http.request(request)
import com.ic.invisiblecollector.IcApiFacade;
import com.ic.invisiblecollector.model.Customer;
IcApiFacade apiFacade = new IcApiFacade("your_api_token_here");
String groupId = "your_group_id";
String customerId = "your_customer_id";
apiFacade.addCustomerToGroup(groupId, customerId);
using InvisibleCollectorLib;
var ic = new InvisibleCollector("your_api_token_here");
string groupId = "your_group_id";
string customerId = "your_customer_id";
await ic.AddCustomerToGroupAsync(groupId, customerId);
iC, err := ic.NewInvisibleCollector("your_api_token_here", ic.InvisibleCollectorUri)
groupId := "your_group_id"
customerId := "your_customer_id"
var channel = make(chan error)
go iC.AddCustomerToGroup(channel, groupId, customerId)
err := <-channel
if err != nil {
fmt.Println("Error:", err)
}
This request does not require a request body, as it operates solely based on the groupId
and customerId
provided in the URL path.
Endpoint
POST https://api.invisiblecollector.com/groups/{groupId}/customers/{customerId}
Path parameters
Attribute | Type | Mandatory | Description |
---|---|---|---|
groupId | string | yes | The ID of the group to which the customer will be added. |
customerId | string | yes | The ID of the customer to be added to the group. |
Response body
If successful, this request will return a JSON object representing the updated group:
{
"id": "1234567890",
"name": "Group Name"
}
Errors
This endpoint may return the following errors
HTTP Code | Description |
---|---|
401 | Unauthorized - Invalid credentials were supplied. |
404 | Not Found - The specified group or customer does not exist. |