To use the api you need to obtain an authentication token.
To get it, here are two example curl commands:
Pass in the body of your request as a string
curl -iX POST \ https://<your sftpg ip>/backend/login \ -H 'Content-Type: application/json' \ -d '{ "username": "admin", "password": "<your password>" }' \ -kPass in the body of your request as a file Your file will look like this (creds.txt):
{"username":"admin","password":"<your password>"}And the curl command will look like this:
curl -iX POST \ https://<your sftpgw ip>/backend/login \ -H 'Content-Type: application/json' \ --data '@/path/to/file/creds.txt' \ -k
The response will return authorization header with the token you need to make all the subsequent requests.
Authorization: Bearer <token>Copy the token. To make requests with this token here are some examples:
1. Get users
curl -X GET \ https://<your sftpg ip>/backend/api/users \ -H 'Authorization: Bearer <token>' \ -k2. Create a user
curl -X POST \ https://<your sftpg ip>/backend/api/users \ -H 'Authorization: Bearer <token>' \ -H 'Content-Type: application/json' \ -d '{ "username": "chris", "bucketName": "", "path": "", "pubSsh": "", "s3EncryptionLevel": "" }' -k3. Delete a user
curl -X DELETE \ https://<your sftpg ip>/backend/api/users/<username> \ -H 'Authorization: Bearer <token>' \ -k