Added context to the backend components API. (#1157)

* Updated provider-api.md.

* Updated DID to make examples work for aqua api.
This commit is contained in:
mariacarmina 2022-11-29 03:46:25 -08:00 committed by GitHub
parent e8939354f3
commit 507b2c9830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 87 deletions

View File

@ -15,7 +15,7 @@
* Example
```bash
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:CbD7aeecB5DFbABaB9126B5Cf1262dCFBA178479'
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:cd086344c275bc7c560e91d472be069a24921e73a2c3798fb2b8caadf8d245d6'
```
* Responses
* 200
@ -45,7 +45,7 @@
* Example
```bash
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/metadata/did:op:CbD7aeecB5DFbABaB9126B5Cf1262dCFBA178479'
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/metadata/did:op:cd086344c275bc7c560e91d472be069a24921e73a2c3798fb2b8caadf8d245d6'
```
* Responses
* 200
@ -78,7 +78,7 @@
curl --location --request POST 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/names' \
--header 'Content-Type: application/json' \
--data-raw '{
"didList" : ["did:op:CbD7aeecB5DFbABaB9126B5Cf1262dCFBA178479"]
"didList" : ["did:op:cd086344c275bc7c560e91d472be069a24921e73a2c3798fb2b8caadf8d245d6"]
}'
```
* Responses
@ -88,7 +88,7 @@
* response body:
```
{"did:op:CbD7aeecB5DFbABaB9126B5Cf1262dCFBA178479": "Ocean Protocol Technical Whitepaper"}
{"did:op:cd086344c275bc7c560e91d472be069a24921e73a2c3798fb2b8caadf8d245d6": "Ocean CEX Aggregator: OHLC history for OCEAN/USDT "}
```
* 400
* content-type: json

View File

@ -14,7 +14,10 @@ Parameters
userAddress: String object containing a user's ethereum address
```
Returns: Json object containing the nonce value.
Returns: Json object containing the last-used nonce value.
The nonce endpoint is just informative, use the current UTC timestamp as a nonce,
where required in other endpoints.
Example:
@ -93,6 +96,52 @@ Response:
b'{"@context": ["https://w3id.org/did/v1"], "id": "did:op:0c184915b07b44c888d468be85a9b28253e80070e5294b1aaed81c ...'
```
### File info endpoint
#### POST /api/services/fileinfo
Retrieves Content-Type and Content-Length from the given URL or asset.
Parameters
For published assets:
```
{
did: String, DID of the dataset
serviceId: String, ID of the service
}
```
For file objects,see https://docs.oceanprotocol.com/core-concepts/did-ddo#files
If checksum is requests, file size should be lower < MAX_CHECKSUM_LENGTH (see Provider ENVs)
If file is larger, checksum WILL NOT be computed.
Returns: Json document file info object
Example:
```
POST /api/services/fileinfo
payload:
{
"did":"0x1111",
"serviceId": "0",
}
```
Response:
```json
[
{
"contentLength":"1161",
"contentType":"application/json",
"index":0,
"valid": true
},...
]
```
### Initial service request endpoint
#### GET /api/services/initialize
@ -167,12 +216,12 @@ Parameters
signature: String object containg user signature (signed message)
```
Returns: File stream
Returns: File stream. Retrieves the attached asset files.
Example:
```
POST /api/services/download
GET /api/services/download
payload:
{
"documentId":"0x1111",
@ -192,48 +241,6 @@ Response:
}
```
### File info endpoint
#### POST /api/services/fileinfo
Retrieves Content-Type and Content-Length from the given URL or asset.
Parameters
```
type: String, either "url" or "asset"
did: String, DID of the dataset
hash: String, hash of the file
url: String, URL of the file
serviceId: String, ID of the service the datatoken is attached to
```
Returns: Json document file info object
Example:
```
POST /api/services/fileinfo
payload:
{
"url": "https://s3.amazonaws.com/testfiles.oceanprotocol.com/info.0.json",
"type": "url",
"method": "GET",
}
```
Response:
```json
[
{
"contentLength":"1161"
"contentType":"application/json"
"index":0
"valid": true
},...
]
```
### Compute endpoints
@ -397,6 +404,34 @@ Response:
]
```
#### GET /api/services/computeResult
Allows download of asset data file.
Parameters
```
jobId: String object containing workflowId (optional)
index: Integer, index of the result to download (optional)
consumerAddress: String object containing consumer's address (optional)
nonce: Integer, Nonce (required)
signature: String object containg user signature (signed message)
```
Returns: Bytes string containing the compute result.
Example:
```
GET /api/services/computeResult?index=0&consumerAddress=0xA78deb2Fa79463945C247991075E2a0e98Ba7A09&jobId=4d32947065bb46c8b87c1f7adfb7ed8b&nonce=1644317370
```
Response:
```
b'{"result": "0x0000000000000000000000000000000000000000000000000000000000000001"}'
```
### Stop
#### PUT /api/services/compute
@ -478,34 +513,6 @@ Response:
]
```
#### GET /api/services/computeResult
Allows download of asset data file.
Parameters
```
jobId: String object containing workflowId (optional)
index: Integer, index of the result to download (optional)
consumerAddress: String object containing consumer's address (optional)
nonce: Integer, Nonce (required)
signature: String object containg user signature (signed message)
```
Returns: Bytes string containing the compute result.
Example:
```
GET /api/services/computeResult?index=0&consumerAddress=0xA78deb2Fa79463945C247991075E2a0e98Ba7A09&jobId=4d32947065bb46c8b87c1f7adfb7ed8b&nonce=1644317370
```
Response:
```
b'{"result": "0x0000000000000000000000000000000000000000000000000000000000000001"}'
```
#### GET /api/services/computeEnvironments
Allows download of asset data file.
@ -528,16 +535,16 @@ Response:
```json
[
{
"cpuType":"AMD Ryzen 7 5800X 8-Core Processor"
"currentJobs":0
"desc":"This is a mocked enviroment"
"diskGB":2
"gpuType":"AMD RX570"
"id":"ocean-compute"
"maxJobs":10
"nCPU":2
"nGPU":0
"priceMin":2.3
"cpuType":"AMD Ryzen 7 5800X 8-Core Processor",
"currentJobs":0,
"desc":"This is a mocked environment",
"diskGB":2,
"gpuType":"AMD RX570",
"id":"ocean-compute",
"maxJobs":10,
"nCPU":2,
"nGPU":0,
"priceMin":2.3,
"ramGB":1
},
...