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

1
const activityId: string = "https://example.com/activities/test-activity";
2
const profileId: string = activityId + "/profiles/myProfileId";
3
const profile: DocumentJson = {
4
myKey: "myValue"
5
};
6
7
xapi.createActivityProfile({
8
activityId: activityId,
9
profileId: profileId,
10
profile: profile
11
});
Copied!

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
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

1
const activityId: string = "https://example.com/activities/test-activity";
2
const profileId: string = activityId + "/profiles/myProfileId";
3
const profile = {
4
myKey: "myValue"
5
};
6
7
xapi.setActivityProfile({
8
activityId: activityId,
9
profileId: profileId,
10
profile: profile
11
});
Copied!

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
Document
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

1
const activityId: string = "https://example.com/activities/test-activity";
2
3
xapi.getActivityProfiles({
4
activityId: activityId
5
}).then((result: AxiosResponse<string[]>) => {
6
const profiles: string[] = result.data;
7
console.log(profiles); // ["https://example.com/activities/test-activity/profiles/myProfileId"]
8
});
Copied!

Parameters

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.

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

1
const activityId: string = "https://example.com/activities/test-activity";
2
const profileId: string = activityId + "/profiles/myProfileId";
3
4
xapi.getActivityProfile({
5
activityId: activityId,
6
profileId: profileId
7
}).then((result: AxiosResponse<Document>) => {
8
const profile: Document = result.data;
9
// do stuff with profile
10
});
Copied!

Parameters

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.

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

1
const activityId: string = "https://example.com/activities/test-activity";
2
const profileId: string = activityId + "/profiles/myProfileId";
3
4
xapi.deleteActivityProfile({
5
activityId: activityId,
6
profileId: profileId
7
});
Copied!

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.
Last modified 1mo ago