Activity Profile Resource
Manages cross-learner state for an activity.
Creates or merges into an activity profile document by the activity identifier and activity profile identifier.
const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId";
const profile: DocumentJson = {
myKey: "myValue"
};
xapi.createActivityProfile({
activityId: activityId,
profileId: profileId,
profile: profile
});
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 | 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". |
This method returns an
AxiosPromise
with empty success data
if successful.Creates or overwrites an activity profile document by the activity identifier and activity profile identifier.
const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId";
const profile = {
myKey: "myValue"
};
xapi.setActivityProfile({
activityId: activityId,
profileId: profileId,
profile: profile
});
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 | 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. |
This method returns an
AxiosPromise
with empty success data
if successful.Gets an array of activity profile identifiers by the activity identifier.
const activityId: string = "https://example.com/activities/test-activity";
xapi.getActivityProfiles({
activityId: activityId
}).then((result: AxiosResponse<string[]>) => {
const profiles: string[] = result.data;
console.log(profiles); // ["https://example.com/activities/test-activity/profiles/myProfileId"]
});
Parameter | Type | Required | Description |
activityId | string | true | The URI of the activity. |
since | Timestamp | false | Only return Activity Profiles stored since specified Timestamp. |
useCacheBuster | boolean | false | Enables cache busting. |
This method returns an
AxiosPromise
with the success data
containing an array of activity profile identifiers if successful.Gets an activity profile document by the activity identifier and the activity profile identifier.
const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId";
xapi.getActivityProfile({
activityId: activityId,
profileId: profileId
}).then((result: AxiosResponse<Document>) => {
const profile: Document = result.data;
// do stuff with profile
});
Parameter | Type | Required | Description |
activityId | string | true | The URI of the activity. |
profileId | string | true | The URI of the profile to be retrieved. |
useCacheBuster | boolean | false | Enables cache busting. |
This method returns an
AxiosPromise
with the success data
containing the stored Document if successful.Deletes an activity profile document by the activity identifier and the activity profile identifier.
const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId";
xapi.deleteActivityProfile({
activityId: activityId,
profileId: profileId
});
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. |
This method returns an
AxiosPromise
with empty success data
if successful.