2020-07-19 14:12:59 +00:00
|
|
|
######################################
|
|
|
|
# Fling Querysheet for restclient.el #
|
|
|
|
######################################
|
|
|
|
|
|
|
|
# Authenticate as user
|
|
|
|
POST http://localhost:8080/api/auth/user
|
2020-07-19 17:30:33 +00:00
|
|
|
Content-Type: application/json
|
2020-07-19 14:12:59 +00:00
|
|
|
{"shareId": "shareId", "authCode":"secret"}
|
|
|
|
-> jq-set-var :token .
|
|
|
|
|
|
|
|
# :token = Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTQ0NjEzNzMsImV4cCI6MTU5NDY0MTM3Mywic3ViIjoiYWRtaW4ifQ.yu6sF1aE6sW4Jx1hBMj6iUsy8xfiaRGlIFVnHK4YkU8
|
|
|
|
|
|
|
|
# Authenticate as admin
|
|
|
|
POST http://localhost:8080/api/auth/admin
|
|
|
|
Content-Type: application/json
|
|
|
|
{"adminName": "admin", "adminPassword":"123"}
|
|
|
|
-> run-hook (restclient-set-var ":token" (buffer-substring-no-properties 1 (line-end-position)))
|
|
|
|
|
2020-07-25 23:33:32 +00:00
|
|
|
:token = Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2NzUxMjAsImV4cCI6MTU5NTg1NTEyMCwic3ViIjoiYWRtaW4ifQ.WzrGTTZTYHYOw8SskHQ2_sob2tzLIF6q8y8_2oyuafs
|
2020-07-19 17:30:33 +00:00
|
|
|
|
2020-07-19 14:12:59 +00:00
|
|
|
# Get all flings
|
|
|
|
GET http://localhost:8080/api/fling
|
2020-07-19 17:30:33 +00:00
|
|
|
Content-Type: application/json
|
|
|
|
:token
|
|
|
|
|
2020-07-25 23:33:32 +00:00
|
|
|
:flingid = 9f7353a3-efaa-41af-9f93-61e02dc5e440
|
|
|
|
|
|
|
|
# Put a fling
|
|
|
|
PUT http://localhost:8080/api/fling/:flingid
|
|
|
|
Content-Type: application/json
|
|
|
|
:token
|
|
|
|
{
|
|
|
|
"id": "9f7353a3-efaa-41af-9f93-61e02dc5e440",
|
|
|
|
"name": "Shared Fling from querysheetsdfasfd",
|
|
|
|
"creationTime": 1595253659362,
|
|
|
|
"shareId": "WWgTlNZJPZDQ6oowUYfxcQqq",
|
|
|
|
"directDownload": false,
|
|
|
|
"allowUpload": false,
|
|
|
|
"shared": true,
|
|
|
|
"expirationClicks": 12
|
|
|
|
}
|
|
|
|
|
2020-07-19 21:45:22 +00:00
|
|
|
# Add a new fling
|
|
|
|
POST http://localhost:8080/api/fling
|
|
|
|
Content-Type: application/json
|
|
|
|
:token
|
|
|
|
{"name": "Shared Fling from querysheet", "expirationClicks": 12, "shared": true}
|
|
|
|
|
2020-07-19 17:30:33 +00:00
|
|
|
# Add a new fling
|
|
|
|
POST http://localhost:8080/api/fling
|
|
|
|
Content-Type: application/json
|
|
|
|
:token
|
|
|
|
{"name": "Unshared Fling from querysheet", "expirationClicks": 12, "shared": false}
|
|
|
|
|
|
|
|
# Add a new fling
|
|
|
|
POST http://localhost:8080/api/fling
|
|
|
|
Content-Type: application/json
|
|
|
|
:token
|
|
|
|
{"name": "Fling from querysheet with Auth", "expirationClicks": 12, "shared": true, "authCode": "abc"}
|
|
|
|
|
|
|
|
# Add a new fling
|
|
|
|
POST http://localhost:8080/api/fling
|
|
|
|
Content-Type: application/json
|
|
|
|
:token
|
|
|
|
{"name": "Fling from querysheet with Auth and very long name", "expirationClicks": 12, "shared": true, "authCode": "abc"}
|
2020-07-19 14:12:59 +00:00
|
|
|
|
2020-07-21 19:24:10 +00:00
|
|
|
# GET derived auth token
|
|
|
|
GET http://localhost:8080/api/auth/derive
|
|
|
|
Content-Type: application/json
|
|
|
|
:token
|
|
|
|
|
2020-07-25 11:41:45 +00:00
|
|
|
:derivedToken = 56c4ff2e-7da7-4582-bd2c-9a81d9a13abb
|
|
|
|
|
2020-07-19 14:12:59 +00:00
|
|
|
#
|
2020-07-25 11:41:45 +00:00
|
|
|
:flingId = 9f7353a3-efaa-41af-9f93-61e02dc5e440
|
2020-07-19 14:12:59 +00:00
|
|
|
|
|
|
|
# Get one fling
|
|
|
|
GET http://localhost:8080/api/fling/:flingId
|
|
|
|
:token
|
|
|
|
|
|
|
|
# Get all artifacts
|
|
|
|
GET http://localhost:8080/api/fling/:flingId/artifacts
|
2020-07-25 11:41:45 +00:00
|
|
|
Content-Type: application/json
|
2020-07-19 14:12:59 +00:00
|
|
|
:token
|
|
|
|
|
2020-07-25 11:41:45 +00:00
|
|
|
:artifactId = 01ba7fb9-9f2e-4809-9b2b-cbce12a92621
|
|
|
|
|
|
|
|
# Get artifact data by derived token
|
|
|
|
GET http://localhost:8080/api/artifacts/:artifactId/data?derivedtoken=:derivedToken
|
|
|
|
Content-Type: application/json
|
|
|
|
|
2020-07-19 14:12:59 +00:00
|
|
|
#
|
|
|
|
GET https://httpbin.org/json
|
|
|
|
-> jq-set-var :my-var .slideshow.slides[0].title
|
|
|
|
|
|
|
|
#
|
|
|
|
GET http://httpbin.org/ip
|
|
|
|
-> run-hook (restclient-set-var ":my-ip" (cdr (assq 'origin (json-read))))
|