Browse Source

Update distributor node api: /asset -> /assets

Leszek Wiesner 3 years ago
parent
commit
1f5b4bee0a

+ 6 - 6
distributor-node/docs/api/index.md

@@ -187,7 +187,7 @@ This operation does not require authentication
 
 ```javascript
 
-fetch('http://localhost:3334/api/v1/asset/{objectId}',
+fetch('http://localhost:3334/api/v1/assets/{objectId}',
 {
   method: 'HEAD'
 
@@ -202,11 +202,11 @@ fetch('http://localhost:3334/api/v1/asset/{objectId}',
 
 ```shell
 # You can also use wget
-curl -X HEAD http://localhost:3334/api/v1/asset/{objectId}
+curl -X HEAD http://localhost:3334/api/v1/assets/{objectId}
 
 ```
 
-`HEAD /asset/{objectId}`
+`HEAD /assets/{objectId}`
 
 Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
 
@@ -247,7 +247,7 @@ const headers = {
   'Accept':'image/*'
 };
 
-fetch('http://localhost:3334/api/v1/asset/{objectId}',
+fetch('http://localhost:3334/api/v1/assets/{objectId}',
 {
   method: 'GET',
 
@@ -263,12 +263,12 @@ fetch('http://localhost:3334/api/v1/asset/{objectId}',
 
 ```shell
 # You can also use wget
-curl -X GET http://localhost:3334/api/v1/asset/{objectId} \
+curl -X GET http://localhost:3334/api/v1/assets/{objectId} \
   -H 'Accept: image/*'
 
 ```
 
-`GET /asset/{objectId}`
+`GET /assets/{objectId}`
 
 Returns a media file.
 

+ 2 - 2
distributor-node/docs/node/index.md

@@ -44,7 +44,7 @@ The api is described by an [OpenAPI](https://swagger.io/specification/) schema l
 
 ## Requesting assets
 
-The assets are requested from the distributor node by using a `GET` request to [`/asset/{objectId}`](../api/index.md#opIdpublic.asset) endpoint.
+The assets are requested from the distributor node by using a `GET` request to [`/assets/{objectId}`](../api/index.md#opIdpublic.asset) endpoint.
 
 There are multiple scenarios of how a distributor will act upon that request, depending on its current state:
 
@@ -120,7 +120,7 @@ In this case
 
 ## Checking asset status
 
-It is possible to check an asset status without affecting the distributor node state in any way (for example - by triggering the process of [fetching the missing data object](#data-fetching)), by sending a [`HEAD` request to `/asset/{objectId}`](../api/index.md#opIdpublic.assetHead) endpoint.
+It is possible to check an asset status without affecting the distributor node state in any way (for example - by triggering the process of [fetching the missing data object](#data-fetching)), by sending a [`HEAD` request to `/assets/{objectId}`](../api/index.md#opIdpublic.assetHead) endpoint.
 
 If the request is valid, the node will respond with, among others, the `x-cache`, `content-length`, `cache-control` headers.
 

+ 1 - 1
distributor-node/src/api-spec/openapi.yml

@@ -49,7 +49,7 @@ paths:
                 $ref: '#/components/schemas/BucketsResponse'
         500:
           description: Unexpected server error
-  /asset/{objectId}:
+  /assets/{objectId}:
     head:
       operationId: public.assetHead
       description: Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)

+ 2 - 2
distributor-node/src/services/httpApi/HttpApiService.ts

@@ -76,8 +76,8 @@ export class HttpApiService {
     )
 
     // Routes
-    app.head('/api/v1/asset/:objectId', this.routeWrapper(publicController.assetHead.bind(publicController)))
-    app.get('/api/v1/asset/:objectId', this.routeWrapper(publicController.asset.bind(publicController)))
+    app.head('/api/v1/assets/:objectId', this.routeWrapper(publicController.assetHead.bind(publicController)))
+    app.get('/api/v1/assets/:objectId', this.routeWrapper(publicController.asset.bind(publicController)))
     app.get('/api/v1/status', this.routeWrapper(publicController.status.bind(publicController)))
     app.get('/api/v1/buckets', this.routeWrapper(publicController.buckets.bind(publicController)))
 

+ 1 - 1
distributor-node/src/types/generated/ConfigJson.d.ts

@@ -102,7 +102,7 @@ export interface DistributorNodeConfiguration {
      */
     maxCachedItemSize?: string
     /**
-     * TTL (in seconds) for dataObjectSourceByObjectId cache used when proxying objects of size greater than maxCachedItemSize to the right storage node
+     * TTL (in seconds) for dataObjectSourceByObjectId cache used when proxying objects of size greater than maxCachedItemSize to the right storage node. Defaults to `60` if not specified.
      */
     dataObjectSourceByObjectIdTTL?: number
   }

+ 1 - 1
distributor-node/src/types/generated/OpenApi.ts

@@ -12,7 +12,7 @@ export interface paths {
     /** Returns list of distributed buckets */
     'get': operations['public.buckets']
   }
-  '/asset/{objectId}': {
+  '/assets/{objectId}': {
     /** Returns a media file. */
     'get': operations['public.asset']
     /** Returns asset response headers (cache status, content type and/or length, accepted ranges etc.) */