This specification defines a RESTful API over HTTPS for the Contract Negotiation Protocol.
- Contract Negotiation HTTPS Binding
- 1 Introduction
- 2 Provider Path Bindings
- 2.1 The
negotiationsEndpoint (Provider-side) - 2.2 The
negotiations/requestEndpoint (Provider-side) - 2.3 The
negotiations/:providerPid/requestEndpoint (Provider-side) - 2.4 The
negotiations/:providerPid/eventsEndpoint (Provider-side) - 2.5 The
negotiations/:providerPid/agreement/verificationEndpoint (Provider-side) - 2.6 The
negotiations/:providerPid/terminationEndpoint (Provider-side)
- 2.1 The
- 3 Consumer Callback Path Bindings
- 3.1 Prerequisites
- 3.2 The
negotiations/offersEndpoint (Consumer-side) - 3.3 The
negotiations/:consumerPid/offersEndpoint (Consumer-side) - 3.4 The
negotiations/:consumerPid/agreementEndpoint (Consumer-side) - 3.5 The
negotiations/:consumerPid/eventsEndpoint (Consumer-side) - 3.6 The
negotiations/:consumerPid/terminationEndpoint (Consumer-side)
-
The
<base>notation indicates the base URL for a Connector endpoint. For example, if the base Connector URL isconnector.example.com, the URLhttps://<base>/negotiations/requestwill map tohttps//connector.example.com/negotiation/request. -
All request and response messages must use the
application/jsonmedia type. Derived media types, e.g.,application/ld+jsonmay be exposed in addition.
In the event of a client request error, the Connector must return an appropriate HTTP 4xx client error code. If an error body is returned it must be a Contract Negotiation Error.
If a client makes a request that results in an invalid state transition as defined by the Contract Negotiation Protocol, it must return an HTTP code 400 (Bad Request) with a Contract Negotiation Error in the response body.
If the Contract Negotiation (CN) does not exist, the Consumer or Provider must return an HTTP 404 (Not Found) response.
If the client is not authorized, the Consumer or Provider must return an HTTP 404 (Not Found) response.
All requests should use the Authorization header to include an authorization token. The semantics of such tokens are not part of this specification. The Authorization HTTP header is optional if the Connector does not require authorization.
| Endpoint | Method | Description |
|---|---|---|
| https://provider.com/negotiations/:providerPid | GET |
Section 2.1.1 |
| https://provider.com/negotiations/request | POST |
Section 2.2.1 |
| https://provider.com/negotiations/:providerPid/request | POST |
Section 2.3.1 |
| https://provider.com/negotiations/:providerPid/events | POST |
Section 2.4.1 |
| https://provider.com/negotiations/:providerPid/agreement/verification | POST |
Section 2.5.1 |
| https://provider.com/negotiations/:providerPid/termination | POST |
Section 2.6.1 |
A CN can be accessed by a Consumer or Provider sending a GET request to negotiations/:providerPid:
GET https://provider.com/negotiations/:providerPid
Authorization: ...
If the CN is found and the client is authorized, the Provider must return an HTTP 200 (OK) response and a body containing the Contract Negotiation:
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractNegotiation",
"dspace:providerPid": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:state" :"REQUESTED"
} Predefined states are: REQUESTED, OFFERED, ACCEPTED, AGREED, VERIFIED, FINALIZED, and TERMINATED (see here.
A CN is started and placed in the REQUESTED state when a Consumer POSTs an initiating Contract Request Message to negotiations/request:
POST https://provider.com/negotiations/request
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractRequestMessage",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:offer": {
"@type": "odrl:Offer",
"@id": "...",
"target": "urn:uuid:3dd1add8-4d2d-569e-d634-8394a8836a88"
},
"dspace:callbackAddress": "https://..."
}-
The
callbackAddressproperty specifies the base endpointURLwhere the client receives messages associated with the CN. Support for theHTTPSscheme is required. Implementations may optionally support other URL schemes. -
Callback messages will be sent to paths under the base URL as described by this specification. Note that Providers should properly handle the cases where a trailing
/is included with or absent from thecallbackAddresswhen resolving full URL.
The Provider must return an HTTP 201 (Created) response with a body containing the Contract Negotiation:
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractNegotiation",
"dspace:providerPid": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:state" :"REQUESTED"
}A Consumer may make an Offer by POSTing a Contract Request Message to negotiations/:providerPid/request:
POST https://provider.com/negotiations/:providerPid/request
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractRequestMessage",
"dspace:providerPid": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:offer": {
"@type": "odrl:Offer",
"@id": "...",
"target": "urn:uuid:3dd1add8-4d2d-569e-d634-8394a8836a88"
}
}If the message is successfully processed, the Provider must return an HTTP 200 (OK) response. The response body is not specified and clients are not required to process it.
A Consumer can POST a Contract Negotiation Event Message to negotiations/:providerPid/events to accept the current Provider's Offer.
POST https://provider.com/negotiations/:providerPid/events
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractNegotiationEventMessage",
"dspace:providerPid": "urn:uuid:a343fcbf-99fc-4ce8-8e9b-148c97605aab",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:eventType": "dspace:ACCEPTED"
}If the CN's state is successfully transitioned, the Provider must return an HTTP code 200 (OK). The response body is not specified and clients are not required to process it.
If the current Offer was created by the Consumer, the Provider must return an HTTP code 400 (Bad Request) with a Contract Negotiation Error in the response body.
The Consumer can POST a Contract Agreement Verification Message to verify an Agreement.
POST https://provider.com/negotiations/:providerPid/agreement/verification
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractAgreementVerificationMessage",
"dspace:providerPid": "urn:uuid:a343fcbf-99fc-4ce8-8e9b-148c97605aab",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833"
}If the CN's state is successfully transitioned, the Provider must return an HTTP code 200 (OK). The response body is not specified and clients are not required to process it.
The Consumer can POST a Contract Negotiation Termination Message to terminate a CN.
POST https://provider.com/negotiations/:providerPid/termination
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractNegotiationTerminationMessage",
"dspace:providerPid": "urn:uuid:a343fcbf-99fc-4ce8-8e9b-148c97605aab",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:code": "...",
"dspace:reason": [
...
]
}If the CN's state is successfully transitioned, the Provider must return HTTP code 200 (OK). The response body is not specified and clients are not required to process it.
| Endpoint | Method | Description |
|---|---|---|
| https://consumer.com/negotiations/offers | POST |
Section 3.2.1 |
| https://consumer.com/:callback/negotiations/:consumerPid/offers | POST |
Section 3.3.1 |
| https://consumer.com/:callback/negotiations/:consumerPid/agreement | POST |
Section 3.4.1 |
| https://consumer.com/:callback/negotiations/:consumerPid/events | POST |
Section 3.5.1 |
| https://consumer.com/:callback/negotiations/:consumerPid/termination | POST |
Section 3.6.1 |
Note: The :callback can be chosen freely by the implementations.
All callback paths are relative to the callbackAddress base URL specified in the Contract Request Message that initiated a CN. For example, if the callbackAddress is specified as https://consumer.com/callback and a callback path binding is negotiations/:consumerPid/offers, the resolved URL will be https://consumer.com/callback/negotiations/:consumerPid/offers.
A CN is started and placed in the OFFERED state when a Provider POSTs a Contract Offer Message to negotiations/offers:
POST https://consumer.com/negotiations/offers
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractOfferMessage",
"dspace:providerPid": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:offer": {
"@type": "odrl:Offer",
"@id": "...",
"target": "urn:uuid:3dd1add8-4d2d-569e-d634-8394a8836a88"
},
"dspace:callbackAddress": "https://..."
}-
The
callbackAddressproperty specifies the base endpoint URL where the client receives messages associated with the CN. Support for the HTTPS scheme is required. Implementations may optionally support other URL schemes. -
Callback messages will be sent to paths under the base URL as described by this specification. Note that Consumers should properly handle the cases where a trailing / is included with or absent from the
callbackAddresswhen resolving full URL.
The Consumer must return an HTTP 201 (Created) response with a body containing the Contract Negotiation:
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractNegotiation",
"dspace:providerPid": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:state" :"OFFERED"
}A Provider may make an Offer by POSTing a Contract Offer Message to the negotiations/:consumerPid/offers callback:
POST https://consumer.com/:callback/negotiations/:consumerPid/offers
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractOfferMessage",
"dspace:providerPid": "urn:uuid:a343fcbf-99fc-4ce8-8e9b-148c97605aab",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:offer": {
"@type": "odrl:Offer",
"@id": "urn:uuid:6bcea82e-c509-443d-ba8c-8eef25984c07",
"odrl:target": "urn:uuid:3dd1add8-4d2d-569e-d634-8394a8836a88",
"dspace:providerId": "urn:tsdshhs636378",
"dspace:consumerId": "urn:jashd766",
...
},
"dspace:callbackAddress": "https://......"
}If the message is successfully processed, the Consumer must return an HTTP 200 (OK) response. The response body is not specified and clients are not required to process it.
The Provider can POST a Contract Agreement Message to the negotiations/:consumerPid/agreement callback to create an Agreement.
POST https://consumer.com/:callback/negotiations/:consumerPid/agreement
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractAgreementMessage",
"dspace:providerPid": "urn:uuid:a343fcbf-99fc-4ce8-8e9b-148c97605aab",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:agreement": {
"@id": "urn:uuid:e8dc8655-44c2-46ef-b701-4cffdc2faa44",
"@type": "odrl:Agreement",
"odrl:target": "urn:uuid:3dd1add4-4d2d-569e-d634-8394a8836d23",
"dspace:timestamp": "2023-01-01T01:00:00Z",
"dspace:providerId": "urn:tsdshhs636378",
"dspace:consumerId": "urn:jashd766",
...
},
"dspace:callbackAddress": "https://......"
}If the CN's state is successfully transitioned, the Consumer must return an HTTP code 200 (OK). The response body is not specified and clients are not required to process it.
A Provider can POST a Contract Negotiation Event Message to the negotiations/:consumerPid/events callback with an eventType of FINALIZED to finalize an Agreement.
POST https://consumer.com/:callback/negotiations/:consumerPid/events
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractNegotiationEventMessage",
"dspace:providerPid": "urn:uuid:a343fcbf-99fc-4ce8-8e9b-148c97605aab",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:eventType": "dspace:FINALIZED"
}If the CN's state is successfully transitioned, the Consumer must return HTTP code 200 (OK). The response body is not specified and clients are not required to process it.
The Provider can POST a Contract Negotiation Termination Message to terminate a CN.
POST https://consumer.com/negotiations/:consumerPid/termination
Authorization: ...
{
"@context": "https://w3id.org/dspace/2024/1/context.json",
"@type": "dspace:ContractNegotiationTerminationMessage",
"dspace:providerPid": "urn:uuid:a343fcbf-99fc-4ce8-8e9b-148c97605aab",
"dspace:consumerPid": "urn:uuid:32541fe6-c580-409e-85a8-8a9a32fbe833",
"dspace:code": "...",
"dspace:reason": [
...
]
}If the CN's state is successfully transitioned, the Consumer must return HTTP code 200 (OK). The response body is not specified and clients are not required to process it.