A profile is a single record in a database. With the Copernica REST API you can retrieve profile information, create new profiles and update existing profiles with new information. With the field-parameter it is also possible to search for profiles through the database. This method gives you access to all profiles associated with a given database.

Request url Methods Parameters
https://api.copernica.com/database/\$databaseID/profiles GET, POST, DELETE fields[], start, limit

GET request

The URL will retrieve all profiles from \$databaseID. Include the limit and/or start parameters in your request to specify the number and range of profiles returned.

The profile secret is used to identify a user in web forms and to auto login a user that clicks from an email to a Copernica-hosted webpage. The hash value is auto generated by Copernica.

If any, you will also receive an array with the interests of the profile, and the date on which the profile was created.

Example output

{
    "start": 0,
    "limit": 8,
    "total": 8,
    "data": [{
        "ID": "1",
        "fields": {
            "Company": "Cinderella Coffeeshop",
            "Address": "3 Mill Road",
            "ZipCode": "PP33 8rG",
            "City": "Cardiff",
            "Country": "United Kingdom",
            "Phone": "44 354 665 6",
            "Website": "www.cinderella-coffee.co.uk",
            "Status": "prospect",
            "AccountManager": "Lenny Lowits",
            "Age": "0"
        },
        "interests": [],
        "database": "1",
        "secret": "c7fd54116ef640c213a6314217b8921d",
        "created": "2014-02-10 10:33:28"
    }, 
    ...
     {
        "ID": "8",
        "fields": {
            "Company": "Warme Wanten Walhalla",
            "Address": "",
            "ZipCode": "",
            "City": "",
            "Country": "",
            "Phone": "",
            "Website": "",
            "Status": "",
            "AccountManager": "",
            "Age": "30"
        },
        "interests": [],
        "database": "1",
        "secret": "4d8db394d5c4192b84c8837432018056",
        "created": "2014-02-10 14:39:29"
    }]
}

Searching for profiles with the GET request

By providing an array of fields and search criteria in the GET request of \$DatabaseID/profiles, it is possible to search for profiles in your database. For example, if you want to search all profiles from your database with id=8, with 'Hank' as firstname (field Firstname="Hank") and which are not subscribed for the newsletter (field Newsletter!="Yes"), the request would look something like this:

database/8/profiles?fields[]=Firstname%3D%3DHank&fields[]=Newsletter%21%3DYes&access_token=...

POST request

A POST request can be used to create a profile. There is no need to include the profile identifier in the message, since the URL contains it.

Example message

{
    "Company" : "Copernica",
    "Visit_Address" : "Copernicaplein 112",
    "Email" : "info@copernica.com",
    ...
}

PUT request

Use the PUT request to update profiles in the database associated with databaseID. The PUT request is always in conjunction with the required fields[] parameter.

DELETE request

A profile can be deleted with the DELETE request. This will remove the profile with identifier \$profileID from the database. No additional information is needed to delete a profile, as the profile identifier is already present in the URL.

Further reading