REST API: POST profile subprofiles

Warning: You are viewing the documentation for the old REST API. We recommend using version 2 of the REST API.

To add subprofiles to a profile an HTTP POST request can be sent to the following URL:$id/subprofiles/$collectionID?access_token=xxxx

The $id should be replaced with the ID of the profile you want to add a subprofile to. The $collectionID should be replaced with collection ID. The new subprofile of the profile can be placed in the body of the message. After a successful call the ID of the created request is returned.

Body data

You can create fields by specifying the properties and assigning it to the data body.

PHP example

The following PHP script demonstrates how the API method can be called.

// dependencies

// change this into your access token
$api = new CopernicaRestApi("your-access-token");

// data to pass to the call, the new interests
$data = array(
    'firstname' =>  'John',
    'lastname'  =>  'Doe',
    'email'     =>  ''

// do the call
$api->post("profile/id/subprofiles/id", $data);

// return id of created request if successful

The example above requires the CopernicaRestApi class.

More information