REST API v4: PUT profile

A method to edit the properties of an existing profile. It is called using the following URL:

https://api.copernica.com/v4/profile/$id

The $id needs to be replaced with the ID of the profile you want to edit the properties of.

Available data

The following data can be placed in the message body of the HTTP PUT command:

  • fields: Fields that the profile contains
  • interests: Interests that the profile contains
  • secret: The secret code that is associated with the profile

JSON example

The following JSON demonstrates how to use the API method:

{
  "fields": {
    "firstname": "John",
    "lastname": "Doe",
    "email": "johndoe@example.com"
  },
  "interests": {
    "football": 1,
    "Honkbal": 0
  }
}

PHP example

The following example demonstrates how to use this method:

// dependencies
require_once('CopernicaRestAPI.php');

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

// data to be sent to the api
$data = array(
    "fields" => array(
        'firstname' =>  'John',
        'lastname'  =>  'Doe',
        'email'     =>  'johndoe@example.com'
    ),
    'interests' = array(
        'football'  =>  0,
        'tennis'    =>  1,
        'hockey'    =>  1
    )
);

// do the call, and print result
print_r($api->put("profile/{$profileID}", $data));

The example above requires the CopernicaRestApi class.

More information