# Activity Profile Resource

## createActivityProfile

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

### **Example**

```typescript
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
});
```

### **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     | [DocumentJson](https://github.com/xapijs/xapi/blob/d7eac9d07166df5c1f995e17a8ac98bbee99c548/src/resources/document/Document.ts) | 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**

```typescript
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
});
```

### **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](https://github.com/xapijs/xapi/blob/d7eac9d07166df5c1f995e17a8ac98bbee99c548/src/resources/document/Document.ts) | 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**

```typescript
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"]
});
```

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

```typescript
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
});
```

### **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](https://github.com/xapijs/xapi/blob/d7eac9d07166df5c1f995e17a8ac98bbee99c548/src/resources/document/Document.ts) if successful.

## deleteActivityProfile

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

### **Example**

```typescript
const activityId: string = "https://example.com/activities/test-activity";
const profileId: string = activityId + "/profiles/myProfileId";

xapi.deleteActivityProfile({
  activityId: activityId,
  profileId: 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.xapijs.dev/xapi-wrapper-library/activity-profile-resource.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
