Agent Profile Resource
Manage information about a particular person.

createAgentProfile

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

Example

1
const agent: Agent = {
2
objectType: "Agent",
3
name: "Test Agent",
4
mbox: "mailto:[email protected]"
5
};
6
const profileId: string = "https://example.com/profiles/myProfileId";
7
const profile: DocumentJson = {
8
myKey: "myValue"
9
};
10
11
xapi.createAgentProfile({
12
agent: agent,
13
profileId: profileId,
14
profile: profile
15
});
Copied!

Parameters

Parameter
Type
Required
Description
agent
Agent
true
The agent experiencing the AU.
profileId
string
true
The URI of the agent 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".
contentType
string
false
The content type of the profile data.

Returns

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

setAgentProfile

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

Example

1
const agent: Agent = {
2
objectType: "Agent",
3
name: "Test Agent",
4
mbox: "mailto:[email protected]"
5
};
6
const profileId: string = "https://example.com/profiles/myProfileId";
7
const profile: Document = {
8
myKey: "myValue"
9
};
10
11
xapi.setAgentProfile({
12
agent: agent,
13
profileId: profileId,
14
profile: profile
15
});
Copied!

Parameters

Parameter
Type
Required
Description
agent
Agent
true
The agent experiencing the AU.
profileId
string
true
The URI of the agent profile to be created or overwritten.
profile
Document
true
The profile data to be stored.
etag
string
true
The ETag of the original document if overwriting.
matchHeader
string
true
The ETag header type. Accepts "If-Match" or "If-None-Match".

Returns

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

getAgentProfiles

Gets an array of agent profile identifiers by the agent.

Example

1
const agent: Agent = {
2
objectType: "Agent",
3
name: "Test Agent",
4
mbox: "mailto:[email protected]"
5
};
6
7
xapi.getAgentProfiles({
8
agent: agent
9
}).then((result: AxiosResponse<string[]>) => {
10
const profiles: string[] = result.data;
11
console.log(profiles); // ["https://example.com/profiles/myProfileId"]
12
});
Copied!

Parameters

Parameter
Type
Required
Description
agent
Agent
true
The agent experiencing the AU.
since
Timestamp
false
Only return Agent 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 agent profile identifiers if successful.

getAgentProfile

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

Example

1
const agent: Agent = {
2
objectType: "Agent",
3
name: "Test Agent",
4
mbox: "mailto:[email protected]"
5
};
6
const profileId: string = "https://example.com/profiles/myProfileId";
7
8
xapi.getAgentProfile({
9
agent: agent,
10
profileId: profileId
11
}).then((result: AxiosResponse<Document>) => {
12
const profile: Document = result.data;
13
// do stuff with profile
14
});
Copied!

Parameters

Parameter
Type
Required
Description
agent
Agent
true
The agent experiencing the AU.
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.

deleteAgentProfile

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

Example

1
const agent: Agent = {
2
objectType: "Agent",
3
name: "Test Agent",
4
mbox: "mailto:[email protected]"
5
};
6
const profileId: string = "https://example.com/profiles/myProfileId";
7
8
xapi.deleteAgentProfile({
9
agent: agent,
10
profileId: profileId
11
});
Copied!

Parameters

Parameter
Type
Required
Description
agent
Agent
true
The agent experiencing the AU.
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