HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Profile methods

Describes the GET, POST, PUT and DELETE methods of the Optimizely Profile Store API, used for querying profile data in Profile Store. Profiles are used for storing aggregated data from visitor interactions.

GET api/v1.0/profiles/{scope}/{profileid}

  • Returns HTTP 200 OK with the profile in the response body, for the ID provided.
  • Returns HTTP 404 NOT FOUND if no profile with the ID was found.

Example of response body:

{
      "ProfileId"          : "6243d1c0-70dd-453e-9cc4-63c577cb25ad",
      "DeviceIds"          : [
                               "9f4447e4-9f00-4fa8-ad30-a1a971d4fbf6"
                             ],
      "Name"               : "Nikki A Blomqvist",
      "ProfileManager"     : null, 
      "FirstSeen"          : "2017-12-01T12:34:56",
      "LastSeen"           : "2018-05-19T11:33:12",
      "Visits"             : 1150,
      "UpdateTime"         : "2019-03-06T21:29:38.4088275Z",
      "Scope"              : "DefaultScope"
      "Info"               : {
                               "Website" : "https://example.com"
                               "Picture" : "http://example.com/Nikki A Blomqvist_avatar.png",
                               "Country" : "SW",
                               "Email"   : "[email protected]"
                             },
      "ContactInformation" : [
                               "Mailable",
                               "Anonymous"
                             ],
      "Payload"            : {
                               "customField"      : 14,
                               "otherCustomField" : "apple"
                             }
    }

POST api/v1.0/profiles/

  • Maximum request body size: 256KB
  • Creates a new profile object.

Example of request body. (Note that ID should be not sent because it is generated by the API. Similarly, UpdateTime is set by the API prior to saving the profile)

{
      "DeviceIds"      : [
                           "1f68f8a6-894b-42ce-aa2a-d5110eba1fba"
                         ],
      "Name"           : "Luke Skywalker",
      "ProfileManager" : null,
      "LastSeen"       : "2018-06-15T00:00:00",
      "Scope"          : "CommerceSite",
      "Visits"         : 1205,
      "Info"           : {
                           "Website"          : "https://example.com"
                           "Picture"          : "http://example.com/profile/luke_avatar.png",
                           "InferredCountry"  : "Sweden",
                           "Email"            : "[email protected]"
                         },
      "Payload"        : {
                           "customField"      : 10,
                           "otherCustomField" : "banana"
                         }
    }
  • In case Scope is null or no Scope is sent, the default value for Scope will be default.

Returns:

  • HTTP 201 CREATED with the created profile in the response body, and with the same structure as when retrieving a profile with the GET method as described above.

    The HTTP response header Location contains the URL to the profile:

      HTTP/1.1 201 Created Location: http://www.example.org/api/v1.0/profiles/df9fbdb3-4141-4d85-b37b-f5664b11a9dc
    
  • HTTP 413 REQUEST ENTITY TOO LARGE if request body is > 256KB.

  • HTTP 409 CONFLICT if a profile cannot be stored due to duplication.

    The profile is considered as duplicated when:

    • An existing profile containing the deviceId is found in Profile Store.
    • An existing profile with the same email (Info.Email) is found in Profile Store.
  • HTTP 400 BAD REQUEST if the request body contains invalid data. Please see the profile model description for details about profile data validation and acceptable values.

PUT api/v1.0/profiles/{id}

  • Maximum request body size: 256KB
  • Replaces an existing profile, or creates a new one if no profile with the specified ID was found.
  • Similar to the POST API, the PUT API sets the UpdateTime of the Profile before udapting it.

Returns:

  • HTTP 201 CREATED (same response as POST method) if profile with ID was not found, so it was created.

  • HTTP 200 OK when a profile was found and replaced (same response as GET method).

  • HTTP 413 REQUEST ENTITY TOO LARGE if request body is > 256KB.

  • HTTP 409 CONFLICT if a profile cannot be replaced due to duplication.

    Profile is considered as duplicated when:

    • An existing profile containing the deviceId is found in Profile Store.
    • An existing profile with the same email is found (Info.Email) in Profile Store.
  • HTTP 400 BAD REQUEST if the request body contains invalid data. See the profile model description for details about profile data validation and acceptable values.

DELETE  api/v1.0/profiles/{scope}/{profileid}

Removes the profile with the specified ID for the specified scope and related events.

Please note that profile events deletion happens in 2 stages. Deleted events are not returned when querying and exporting data or executing segment. Actual data deletion usually is scheduled once a day. The cleaning period may be longer, depending on other tasks and the load on the system.

Up to 1 million events can be deleted before the next data cleaning is performed.

Returns:

  • HTTP 200 OK in case the deletion of both profile and its related track events was successful.
  • HTTP 404 NOT FOUND if no profile with the ID was found.
  • HTTP 429 TOO MANY REQUESTS if more than 1 million events would be deleted after this operation. See Retry-After response header for the suggested time for retry.
  • HTTP 500 INTERNAL SERVER ERROR when an unexpected server error occurs.