Activity Profile Resource

Manages cross-learner state for an activity.

createActivityProfile

Creates or merges into an activity profile document by the activity identifier and activity profile identifier.

Example

const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId"
const profile = {
myKey: "myValue"
}
xapi.createActivityProfile(activityId, profileId, profile);

Parameters

Parameter

Type

Required

Description

activityId

string

true

The URI of the activity.

profileId

string

true

The URI of the activity profile to be created or merged into.

profile

any

true

The profile data to be stored.

etag

string

false

The ETag of the original document if merging.

matchHeader

string

false

The ETag header type. Accepts "If-Match" or "If-None-Match".

Returns

This method returns an AxiosPromise with empty success data if successful.

setActivityProfile

Creates or overwrites an activity profile document by the activity identifier and activity profile identifier.

Example

const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId"
const profile = {
myKey: "myValue"
}
xapi.setActivityProfile(activityId, profileId, profile);

Parameters

Parameter

Type

Required

Description

activityId

string

true

The URI of the activity.

profileId

string

true

The URI of the activity profile to be created or overwritten.

profile

any

true

The profile data to be stored.

etag

string

true

The ETag of the original document.

matchHeader

string

true

The ETag header type. Accepts "If-Match" or "If-None-Match".

contentType

string

false

The content type of the profile data.

Returns

This method returns an AxiosPromise with empty success data if successful.

getActivityProfiles

Gets an array of activity profile identifiers by the activity identifier.

Example

const activityId: string = "https://example.com/activities/test-activity";
xapi.getActivityProfiles(activityId).then((result: AxiosResponse) => {
const profiles: string[] = result.data;
console.log(profiles); // ["https://example.com/activities/test-activity/profiles/myProfileId"]
});

Parameters

Parameter

Type

Required

Description

activityId

string

true

The URI of the activity.

since

Timestamp

false

Only return Activity Profiles stored since specified Timestamp.

Returns

This method returns an AxiosPromise with the success data containing an array of activity profile identifiers if successful.

getActivityProfile

Gets an activity profile document by the activity identifier and the activity profile identifier.

Example

const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId"
xapi.getActivityProfile(activityId, profileId).then((result: AxiosResponse) => {
const profile: any = result.data;
// do stuff with profile
});

Parameters

Parameter

Type

Required

Description

activityId

string

true

The URI of the activity.

profileId

string

true

The URI of the profile to be retrieved.

Returns

This method returns an AxiosPromise with the success data containing the stored document if successful.

deleteActivityProfile

Deletes an activity profile document by the activity identifier and the activity profile identifier.

Example

const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId"
xapi.deleteActivityProfile(activityId, profileId);

Parameters

Parameter

Type

Required

Description

activityId

string

true

The URI of the activity.

profileId

string

true

The URI of the profile to be deleted.

etag

string

false

The ETag of the original document.

Returns

This method returns an AxiosPromise with empty success data if successful.