mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
GITBOOK-259: change request with no subject merged in GitBook
This commit is contained in:
parent
c6ed2d2aa0
commit
1bbd9dfe2f
@ -1,9 +1,11 @@
|
||||
# Authentication Endpoints
|
||||
|
||||
Provider offers an alternative to signing each request, by allowing users to generate auth tokens. The generated auth token can be used until its expiration in all supported requests. Simply omit the signature parameter and add the AuthToken request header based on a created token.
|
||||
Provider offers an alternative to signing each request, by allowing users to generate auth tokens. The generated auth token can be used until its expiration in all supported requests. Simply omit the signature parameter and add the AuthToken request header based on a created token.
|
||||
|
||||
Please note that if a signature parameter exists, it will take precedence over the AuthToken headers. All routes that support a signature parameter support the replacement, with the exception of auth-related ones (createAuthToken and deleteAuthToken need to be signed).
|
||||
|
||||
### Create Auth Token
|
||||
|
||||
#### GET /api/services/createAuthToken
|
||||
|
||||
Allows the user to create an auth token.
|
||||
@ -35,6 +37,8 @@ Response:
|
||||
{"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NjAwNTMxMjksImFkZHJlc3MiOiIweEE3OGRlYjJGYTc5NDYzOTQ1QzI0Nzk5MTA3NUUyYTBlOThCYTdBMDkifQ.QaRqYeSYxZpnFayzPmUkj8TORHHJ_vRY-GL88ZBFM0o"}
|
||||
```
|
||||
|
||||
#### Delete Auth Token
|
||||
|
||||
#### DELETE /api/services/deleteAuthToken
|
||||
|
||||
Allows the user to delete an existing auth token before it naturally expires.
|
||||
|
@ -29,61 +29,6 @@ console.log(response)
|
||||
|
||||
```
|
||||
|
||||
#### GET /api/services/initialize
|
||||
|
||||
Parameters
|
||||
|
||||
```
|
||||
documentId: String object containing document id (e.g. a DID)
|
||||
serviceId: String, ID of the service the datatoken is attached to
|
||||
consumerAddress: String object containing consumer's address
|
||||
environment: String representing a compute environment offered by the provider
|
||||
validUntil: Integer, date of validity of the service (optional)
|
||||
fileIndex: Integer, the index of the file from the files list in the dataset. If set, provider will validate the file access. (optional)
|
||||
```
|
||||
|
||||
Returns: Json document with a quote for amount of tokens to transfer to the provider account.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
GET /api/services/initialize
|
||||
payload:
|
||||
{
|
||||
"documentId":"0x1111",
|
||||
"serviceId": 0,
|
||||
"consumerAddress":"0x990922334",
|
||||
}
|
||||
payload (with optional parameters):
|
||||
{
|
||||
"documentId":"0x1111",
|
||||
"serviceId": 0,
|
||||
"consumerAddress":"0x990922334",
|
||||
"validUntil": 1578004800,
|
||||
"fileIndex": 1
|
||||
}
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"datatoken": "0x21fa3ea32892091...",
|
||||
"nonce": 23,
|
||||
"providerFee": {
|
||||
"providerFeeAddress": "0xabc123...",
|
||||
"providerFeeToken": "0xabc123...",
|
||||
"providerFeeAmount": "200",
|
||||
"providerData": "0xabc123...",
|
||||
"v": 27,
|
||||
"r": "0xabc123...",
|
||||
"s": "0xabc123...",
|
||||
"validUntil": 123456,
|
||||
},
|
||||
"computeAddress": "0x8123jdf8sdsa..."
|
||||
}
|
||||
```
|
||||
|
||||
### Decrypt endpoint
|
||||
|
||||
* **Endpoint**: `POST /api/services/decrypt`
|
||||
|
@ -73,3 +73,37 @@ Example response:
|
||||
* **Purpose**: This endpoint is used to retrieve the attached asset files. It returns a file stream of the requested file.
|
||||
* **Responses**:
|
||||
* **200**: This is a successful HTTP response code. It means the server has successfully processed the request and returned the file stream.
|
||||
|
||||
### Initialize
|
||||
|
||||
* **Endpoint**: `GET /api/services/initialize`
|
||||
* **Parameters**: The query parameters for this endpoint should contain the following properties:
|
||||
* `documentId`: A string containing the document id (e.g., a DID).
|
||||
* `serviceId`: A string representing the ID of the service the data token is attached to.
|
||||
* `consumerAddress`: A string containing the consumer's Ethereum address.
|
||||
* `environment`: A string representing a compute environment offered by the provider.
|
||||
* `validUntil`: An integer representing the date of validity of the service (optional).
|
||||
* `fileIndex`: An integer representing the index of the file from the files list in the dataset. If set, the provider will validate the file access (optional).
|
||||
* **Purpose**: This endpoint is used to initialize a service and return a quote for the number of tokens to transfer to the provider's account.
|
||||
* **Responses**:
|
||||
* **200**: This is a successful HTTP response code. It returns a JSON object containing information about the quote for tokens to be transferred.
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"datatoken": "0x21fa3ea32892091...",
|
||||
"nonce": 23,
|
||||
"providerFee": {
|
||||
"providerFeeAddress": "0xabc123...",
|
||||
"providerFeeToken": "0xabc123...",
|
||||
"providerFeeAmount": "200",
|
||||
"providerData": "0xabc123...",
|
||||
"v": 27,
|
||||
"r": "0xabc123...",
|
||||
"s": "0xabc123...",
|
||||
"validUntil": 123456,
|
||||
},
|
||||
"computeAddress": "0x8123jdf8sdsa..."
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user