Skip to content

Interface: REST-API

Configuration

Update LeoGateway's protocol configuration to rest in your LeoGateway configuration

1
2
3
4
5
## --------------------------------------------------------------------
## GATEWAY Protocol
## --------------------------------------------------------------------
## Gateway Protocol to use: [s3 | rest | embed | nfs]
protocol = rest

Interface

Description of LeoFS’ behavior for each HTTP verb

HTTP Verb LeoFS’ Behavior
PUT/POST Insert an object into the storage cluster
GET Retrieve an object from the storage cluster
DELETE Remove an object from the storage cluster

URL format

  • URL format: http[s]://<HOST>:8080/<FILEPATH>
    • LeoFS only uses the <FILEPATH> which part of the URL to identify objects.
    • You can check that an object exists in a LeoFS' cluster by using leofs-adm whereis command.
1
$ leofs-adm whereis <FILEPATH>

Examples

POST/PUT

1
2
3
4
5
$ curl -X POST -H "Content-Type:image/jpg" \
          --data-binary @test_1.jpg https://hostname:8080/_test/_image/file.png

$ curl -X PUT -H "Content-Type:image/jpg" \
          --data-binary @test_2.jpg https://hostname:8080/_test/_image/file.png

GET

1
$ curl -X GET https://hostname:8080/_test/_image/test_2.jpg

DELETE

1
$ curl -X DELETE https://hostname:8080/_test/_image/file.png