Storage of 5GTANGO Packages and Arbitrary Files - sonata-nfv/tng-cat GitHub Wiki

In this page, the documentation of the API regarding the storage of 5GTANGO packages and arbitrary files is provided. The API for 5GTANGO packages (tgo-package) and arbitrary files works very similarly to the API for the descriptors. Packages are compressed files, hosting several individual entities, some of which are descriptors, arbitrary files, etc. In order to support the storage of this kind of files, additional endpoints are provided. The structure information of 5GTANGO packages can be found here. Last but not least, the API reference of <base_url> can be found here.

POST Method

The POST method provides the upload of 5GTANGO packages and arbitrary files.

Upload a 5GTANGO package

In order to upload a 5GTANGO package file, which is named as 5gtango-test-package.tgo, you can use

curl -X POST -H "Content-Type: application/zip" -H "Content-Disposition: attachment; filename=5gtango-test-package.tgo" --data-binary @5gtango-test-package.tgo  <base URL>/api/v2/tgo-packages

Header 'Content-Type' must be set to application/zip for tgo-packages. Also, the HTTP header 'Content-Disposition' must be set to attachment; filename=<name of the package file>.

Upload an arbitrary file

In order to upload an arbitrary file, which is named as MyExample.cfg, you can use

curl -X POST -H "Content-Type: application/octet-stream" -H "Content-Disposition: attachment; filename=MyExample.cfg" --data-binary @MyExample.cfg <base URL>/api/v2/files

Header 'Content-Type' must be set to application/octet-stream for files. Also, the HTTP header 'Content-Disposition' must be set to attachment; filename=<name of the package file>.

GET Method

The GET method provides the retrieval of 5GTANGO packages and arbitrary files. Dependent on the request, different endpoints are created and analyzed below.

List all the available metadata of 5GTANGO packages

The request can be created with json or yml extension format of the response. An example in json format is:

curl -H "Content-Type: application/json" <base URL>/api/v2/tgo-packages

List all the available metadata of arbitrary files

The request can be created with json or yml extension format of the response. An example in json format is:

curl -H "Content-Type: application/json" <base URL>/api/v2/files

Retrieve metadata of 5GTANGO Package using the UUID

The request can be created with json or yml extension format of the response. An example in json format is:

curl -H "Content-type:application/json" /api/v2/tgo-packages/c382c6d1-41c9-42cb-b442-44f434d86ba9

Retrieve metadata of arbitrary file using the UUID

The request can be created with json or yml extension format of the response. An example in json format is:

curl -H "Content-type:application/json" /api/v2/files/c382c6d1-41c9-42cb-b442-44f434d86ba9

Retrieve the binary data of 5GTANGO Package using the uuid

To receive the raw data response of a 5GTANGO package, the request can be created by setting the header Content-Type as application/zip, similar to the following example:

curl -H "Content-Type:application/zip" <base URL>/api/v2/tgo-packages/c382c6d1-41c9-42cb-b442-44f434d86ba9

Retrieve the binary data of arbitrary file using the uuid

Same as above, in order to receive the raw data response of a fil, the request can be created by setting the header Content-Type as application/octet-stream, similar to the following example:

curl -H "Content-Type:application/octet-stream" <base URL>/api/v2/files/c382c6d1-41c9-42cb-b442-44f434d86ba9

the header Content-Type defines the format of the response and can be configured also as application/json. To receive the raw data response of a package/arbitrary file, you can use

DELETE method

The DELETE method provides the deletion of 5GTANGO packages and arbitrary files. Dependent on the request, different endpoints are created and analyzed below

Delete a 5GTANGO package by its ID

In order to delete a specific 5GTANGO package using its UUID, the endpoint is:

curl -X DELETE <base URL>/api/v2/tgo-packages/c382c6d1-41c9-42cb-b442-44f434d86ba9

Delete an arbitrary file by its ID

In order to delete a specific arbitrary file using its UUID, the endpoint is:

curl -X DELETE <base URL>/api/v2/files/c382c6d1-41c9-42cb-b442-44f434d86ba9

The same approach is followed for the upload of arbitrary files

curl -X DELETE http://localhost:4011/api/catalogues/v2/files/{id}
⚠️ **GitHub.com Fallback** ⚠️