Presentations

Presentations Management

1. Send a Presentation

To send a presentation to another profile, use the sendPresentation method. This method accepts a profileId, a vp object, and an optional encrypt parameter.

const profileId = 'janesmith';
const vp = your_presentation;
const encrypt = true;

await learnCard.invoke.sendPresentation(profileId, vp, encrypt);

Send a Presentation

This endpoint sends a presentation to a user based on their profileId

POST../api/presentation/send/{profileId}
Authorization
Path parameters
profileId*string
Body
presentation*any of
Response

Successful response

Body
string
Request
const response = await fetch('../api/presentation/send/{profileId}', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "presentation": {
        "@context": [
          "text"
        ],
        "type": "text",
        "proof": {
          "type": "text",
          "created": "text",
          "proofPurpose": "text",
          "verificationMethod": "text"
        }
      }
    }),
});
const data = await response.json();
Response
text

2. Accept a Presentation

To accept a presentation, use the acceptPresentation method. This method accepts a uri parameter.

const uri = 'your_presentation_uri';

await learnCard.invoke.acceptPresentation(uri);

Accept a Presentation

This endpoint accepts a presentation

POST../api/presentation/accept/{uri}
Authorization
Path parameters
uri*string
Response

Successful response

Body
boolean
Request
const response = await fetch('../api/presentation/accept/{uri}', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
false

3. Get Received Presentations

To retrieve all received presentations, use the getReceivedPresentations method. This method accepts an optional from parameter.

const from = 'johnsmith';

await learnCard.invoke.getReceivedPresentations(from);

Get received presentations

This endpoint returns the current user's received presentations

GET../api/presentation/received
Authorization
Query parameters
Response

Successful response

Body
uri*string
to*string
from*string
sent*string (date-time)
receivedstring (date-time)
Request
const response = await fetch('../api/presentation/received', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
[
  {
    "uri": "text",
    "to": "text",
    "from": "text",
    "sent": "2024-09-14T17:40:59.936Z",
    "received": "2024-09-14T17:40:59.936Z"
  }
]

4. Get Sent Presentations

To retrieve all sent presentations, use the getSentPresentations method. This method accepts an optional to parameter.

const to = 'janesmith';

await learnCard.invoke.getSentPresentations(to);

Get sent presentations

This endpoint returns the current user's sent presentations

GET../api/presentation/sent
Authorization
Query parameters
Response

Successful response

Body
uri*string
to*string
from*string
sent*string (date-time)
receivedstring (date-time)
Request
const response = await fetch('../api/presentation/sent', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
[
  {
    "uri": "text",
    "to": "text",
    "from": "text",
    "sent": "2024-09-14T17:40:59.936Z",
    "received": "2024-09-14T17:40:59.936Z"
  }
]

5. Get Incoming Presentations

To retrieve all incoming presentations, use the getIncomingPresentations method. This method accepts an optional from parameter.

const from = 'johnsmith';

await learnCard.invoke.getIncomingPresentations(from);

Get incoming presentations

This endpoint returns the current user's incoming presentations

GET../api/presentation/incoming
Authorization
Query parameters
Response

Successful response

Body
uri*string
to*string
from*string
sent*string (date-time)
receivedstring (date-time)
Request
const response = await fetch('../api/presentation/incoming', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
[
  {
    "uri": "text",
    "to": "text",
    "from": "text",
    "sent": "2024-09-14T17:40:59.936Z",
    "received": "2024-09-14T17:40:59.936Z"
  }
]

6. Delete a Presentation

To delete a presentation, use the deletePresentation method. This method accepts a uri parameter.

const uri = 'your_presentation_uri';

await learnCard.invoke.deletePresentation(uri);

Delete a presentation

This endpoint deletes a presentation

DELETE../api/presentation/{uri}
Authorization
Path parameters
uri*string
Response

Successful response

Body
boolean
Request
const response = await fetch('../api/presentation/{uri}', {
    method: 'DELETE',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
false

Last updated