# Resolution (DCP)

{% hint style="info" %}
Specifications and best practice implementations for Verifiable Credentials are currently being developed. This page is expected to be updated, closely following these developments.
{% endhint %}

The `POST` request to the `/presentations/query` endpoint queries the holder for credentials, after which the holder sends a set of Verifiable Presentations as a response.

{% hint style="info" %}
The `POST` request to the `/presentations/query` is an **OPTIONAL** endpoint and is part of the iSHARE Framework's Verifiable Credentials support in line with the **Decentralised Claims Protocol (DCP)**.
{% endhint %}

## Verifier requests Verifiable Presentation from holder

> The Resolution API defines the Credential Service endpoint for querying credentials and returning a set of Verifiable Presentations. More information in the \[DCP specification]\(<https://eclipse-dataspace-dcp.github.io/decentralized-claims-protocol/v1.0/#resolution-api>.

```json
{"openapi":"3.1.0","info":{"title":"iSHARE Decentralized Claims Protocol (DCP) API specifications","version":"3.0"},"tags":[{"name":"Holder","description":"Endpoints relevant for the VC Holder role (e.g., storing credentials, receiving offers)."}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"iSHARE JWT Bearer token authentication"}}},"paths":{"/presentations/query":{"post":{"tags":["Holder"],"summary":"Verifier requests Verifiable Presentation from holder","description":"The Resolution API defines the Credential Service endpoint for querying credentials and returning a set of Verifiable Presentations. More information in the [DCP specification](https://eclipse-dataspace-dcp.github.io/decentralized-claims-protocol/v1.0/#resolution-api.","operationId":"post-vp-request","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/x-ext/5c2969b"}}}},"responses":{"200":{"description":"VP request received successfully","content":{"application/json":{"schema":{"$ref":"#/x-ext/5dff8d7"}}}},"400":{"description":"Bad Request - possibly because both PresentationQueryMessage and presentationDefinition are provided (only one is allowed)"},"500":{"description":"Internal Server Error"}}}}}}
```

### Request model

The model for the PresentationQueryMessage is defined in: <https://eclipse-dataspace-dcp.github.io/decentralized-claims-protocol/v1.0/resources/presentation/presentation-query-message-schema.json>. Verifiable presentations containing credentials may be requested using [scopes](https://eclipse-dataspace-dcp.github.io/decentralized-claims-protocol/v1.0/#scopes) or using a [presentation definition](https://identity.foundation/presentation-exchange/spec/v2.1.1/#presentation-definition).

* `@context`\
  **Array of Strings**. Root level. <mark style="color:red;">(Required)</mark>\
  Specifies a valid Json-Ld context. Must contain `"https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"`
* `type`\
  **String**. Root level. <mark style="color:red;">(Required)</mark>\
  A string specifying the PresentationQueryMessage type. Must contain `"PresentationQueryMessage"`
* `scope`\
  **Array of Strings**. Root level.\
  A non-empty array of scopes.
* `presentationDefinition`\
  **Object**. Root level.\
  An object containing the definition of the requested presentation. Further details on <https://identity.foundation/presentation-exchange/spec/v2.1.1/#presentation-definition>.

A `PresentationQueryMessage` *MUST* contain either a `presentationDefinition` or a `scope` parameter. If both parameters are present it is an error and the client *MUST* return an `HTTP 400 BAD REQUEST` response.

### Example request

#### Example using scopes

```json
POST /presentations/query
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json

{
  "@context": [
    "https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"
  ],
  "type": "PresentationQueryMessage",
  "scope": [
    "org.eclipse.dspace.dcp.vc.type:X509CertificateCredential",
    "org.eclipse.dspace.dcp.vc.type:FrameworkComplianceCredential",
    "org.eclipse.dspace.dcp.vc.type:FrameworkAgreementCredential",
    "org.eclipse.dspace.dcp.vc.type:FrameworkRoleCredential"
  ]
}
```

#### Example using presentation definition

```json
POST /presentations/query
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json

{
  "@context": [
    "https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"
  ],
  "type": "PresentationQueryMessage",
  "presentationDefinition": {
    "id": "ishareFrameworkCompliance",
    "name": "iSHARE Framework Compliance",
    "purpose": "Request proof of compliance with the iSHARE Framework",
    "input_descriptors": [
      {
        "id": "ishareFrameworkComplianceFrameworkIdAndStatus",
        "format": {
          "ldp_vc": {
            "proof_type": [
              "Ed25519Signature2018"
            ]
          }
        },
        "constraints": {
          "fields": [
            {
              "path": [
                "$.type"
              ],
              "filter": {
                "type": "string",
                "pattern": "FrameworkCompliance"
              }
            },
            {
              "path": [
                "$.frameworkId"
              ],
              "filter": {
                "type": "string",
                "pattern": "iSHARE"
              }
            },
            {
              "path": [
                "$.status"
              ],
              "filter": {
                "type": "string",
                "pattern": "active"
              }
            }
          ]
        }
      }
    ]
  }
}
```

### Response model

On succesfull receipt of the PresentationRequestMessage, the holder must return a 200 code and a PresentationResponseMessage. A `PresentationResponseMessage` should only include valid (non-expired, non-revoked, non-suspended) credentials. The model for the PresentationQueryMessage is defined in: <https://eclipse-dataspace-dcp.github.io/decentralized-claims-protocol/v1.0/resources/presentation/presentation-response-message-schema.json>.

* `@context`\
  **Array of Strings**. Root level. <mark style="color:red;">(Required)</mark>\
  Specifies a valid Json-Ld context. Must contain `"https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"`
* `type`\
  **String**. Root level. <mark style="color:red;">(Required)</mark>\
  A string specifying the PresentationResponseMessage type. Must contain `"PresentationResponseMessage"`
* `presentation`\
  **Array of Strings**. Root level.\
  An array of Verifiable Presentations. The Verifiable Presentations may be strings, JSON objects, or a combination of both depending on the format.
* `presentationSubmission`\
  **Object**. Root level.\
  A valid Presentation Submission. Further details on <https://identity.foundation/presentation-exchange/spec/v2.1.1/>.

Implementations that support the `presentationDefinition` parameter *MUST* include the `presentationSubmission` parameter.

### Example response

#### Example including presentations

```json
{
  "@context": [
    "https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"
  ],
  "type": "PresentationResponseMessage",
  "presentation": [
    "presentation1",
    "presentation2"
  ]
}
```

#### Example including presentation and presentationSubmission

```json
{
  "@context": [
    "https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"
  ],
  "type": "PresentationResponseMessage",
  "presentation": [
    "jwtPresentation"
  ],
  "presentationSubmission": {
    "id": "ishareFrameworkCompliancePresentation",
    "definition_id": "ishareFrameworkCompliance",
    "descriptor_map": [
      {
        "id": "ishareFrameworkComplianceFrameworkIdAndStatus",
        "format": "jwt_vp",
        "path": "$.presentation[0]"
      }
    ]
  }
}
```


---

# 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://dev.ishare.eu/all-roles-common-endpoints/m2m-verifiable-credential-endpoints/resolution-dcp.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.
