fling/examples/querysheet.http
Armin Friedl a07379ebad
All checks were successful
continuous-integration/drone/push Build is passing
Generate derived authentication tokens
Can be used to authorize download urls via query parameter since
the tokens can be used only once.
2020-07-21 21:24:10 +02:00

72 lines
2.2 KiB
HTTP

######################################
# Fling Querysheet for restclient.el #
######################################
# Authenticate as user
POST http://localhost:8080/api/auth/user
Content-Type: application/json
{"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)))
:token = Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTUxNzY4OTksImV4cCI6MTU5NTM1Njg5OSwic3ViIjoiYWRtaW4ifQ.uRh_xBCrBiLQEBah9I8bYWM-Zph-V_pzQVdaGSU5Mlc
# Get all flings
GET http://localhost:8080/api/fling
Content-Type: application/json
:token
# Add a new fling
POST http://localhost:8080/api/fling
Content-Type: application/json
:token
{"name": "Shared Fling from querysheet", "expirationClicks": 12, "shared": true}
# 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"}
# GET derived auth token
GET http://localhost:8080/api/auth/derive
Content-Type: application/json
:token
#
:flingId = dfc208a3-5924-43b4-aa6a-c263541dca5e
# Get one fling
GET http://localhost:8080/api/fling/:flingId
:token
# Get all artifacts
GET http://localhost:8080/api/fling/:flingId/artifacts
:token
#
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))))