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

const agent: Agent = {
objectType: "Agent",
name: "Test Agent",
mbox: "mailto:[email protected]"
};
const profileId: string = "https://example.com/profiles/myProfileId"
const profile = {
myKey: "myValue"
}
xapi.createAgentProfile(agent, profileId, profile);

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

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

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

const agent: Agent = {
objectType: "Agent",
name: "Test Agent",
mbox: "mailto:[email protected]"
};
const profileId: string = "https://example.com/profiles/myProfileId"
const state = {
myKey: "myValue"
}
xapi.setAgentProfile(agent, profileId, profile);

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

any

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

const agent: Agent = {
objectType: "Agent",
name: "Test Agent",
mbox: "mailto:[email protected]"
};
xapi.getAgentProfiles(agent).then((profiles: string[]) => {
console.log(profiles); // ["https://example.com/profiles/myProfileId"]
});

Parameters

Parameter

Type

Required

Description

agent

Agent

true

The agent experiencing the AU.

since

Timestamp

false

Only return Agent Profiles stored since specified Timestamp.

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

const agent: Agent = {
objectType: "Agent",
name: "Test Agent",
mbox: "mailto:[email protected]"
};
const profileId: string = "https://example.com/profiles/myProfileId"
xapi.getAgentProfile(agent, profileId).then((result: AxiosResponse) => {
const profile: any = result.data;
// do stuff with profile
});

Parameters

Parameter

Type

Required

Description

agent

Agent

true

The agent experiencing the AU.

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.

deleteAgentProfile

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

Example

const agent: Agent = {
objectType: "Agent",
name: "Test Agent",
mbox: "mailto:[email protected]"
};
const profileId: string = "https://example.com/profiles/myProfileId"
xapi.deleteAgentProfile(agent, profileId);

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.