correct api endpoints
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Reader user</legend>
|
<legend>Reader user</legend>
|
||||||
<p><code>reader</code> / <code>reader-password</code></p>
|
<p><code>reader</code> / <code>reader-password</code></p>
|
||||||
<p class="muted">Can read protected endpoints and use filters.</p>
|
<p class="muted">Can read protected endpoints and use filters.</p><br>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
@@ -63,42 +63,42 @@
|
|||||||
<span>Linux / curl</span>
|
<span>Linux / curl</span>
|
||||||
</summary>
|
</summary>
|
||||||
<div class="workflow-content">
|
<div class="workflow-content">
|
||||||
<h3>Reader user — filtered reads</h3>
|
<h3>Reader user examples</h3>
|
||||||
<pre><code>READER_TOKEN=$(curl -s -X POST http://localhost:8080/login \
|
<pre><code>READER_TOKEN=$(curl -s -X POST https://go-api.poc.fló.fo/login \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{"user_name":"reader","password":"reader-password"}' \
|
-d '{"user_name":"reader","password":"reader-password"}' \
|
||||||
| sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
|
| sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
|
||||||
|
|
||||||
curl -s 'http://localhost:8080/api/v1/registrations?location=Tórshavn&limit=5' \
|
curl -s 'http://go-api.poc.fló.fo/api/v1/registrations?location=Tórshavn&limit=5' \
|
||||||
-H "Authorization: $READER_TOKEN"
|
-H "Authorization: $READER_TOKEN"
|
||||||
|
|
||||||
curl -s 'http://localhost:8080/api/v1/registrations?gender=female&abuse_type=psychological&status=open&limit=10' \
|
curl -s 'http://go-api.poc.fló.fo/api/v1/registrations?gender=female&abuse_type=psychological&status=open&limit=10' \
|
||||||
-H "Authorization: $READER_TOKEN"
|
-H "Authorization: $READER_TOKEN"
|
||||||
|
|
||||||
curl -s 'http://localhost:8080/api/v1/registrations?from=1989-01-01&to=1990-01-01&offset=20&limit=10' \
|
curl -s 'http://go-api.poc.fló.fo/api/v1/registrations?from=1989-01-01&to=1990-01-01&offset=20&limit=10' \
|
||||||
-H "Authorization: $READER_TOKEN"
|
-H "Authorization: $READER_TOKEN"
|
||||||
|
|
||||||
curl -s 'http://localhost:8080/api/v1/locations' \
|
curl -s 'http://go-api.poc.fló.fo/api/v1/locations' \
|
||||||
-H "Authorization: $READER_TOKEN"</code></pre>
|
-H "Authorization: $READER_TOKEN"</code></pre>
|
||||||
|
|
||||||
<h3>CRUD user — create, update, delete</h3>
|
<h3>CRUD user — create, update, and delete examples</h3>
|
||||||
<pre><code>ADMIN_TOKEN=$(curl -s -X POST http://localhost:8080/login \
|
<pre><code>ADMIN_TOKEN=$(curl -s -X POST https://go-api.poc.fló.fo/login \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{"user_name":"admin","password":"admin-password"}' \
|
-d '{"user_name":"admin","password":"admin-password"}' \
|
||||||
| sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
|
| sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
|
||||||
|
|
||||||
CREATED_ID=$(curl -s -X POST http://localhost:8080/api/v1/registrations \
|
CREATED_ID=$(curl -s -X POST https://go-api.poc.fló.fo/api/v1/registrations \
|
||||||
-H "Authorization: $ADMIN_TOKEN" \
|
-H "Authorization: $ADMIN_TOKEN" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{"gender":"unknown","location":"Tórshavn","abuse_type":"psychological","status":"new"}' \
|
-d '{"gender":"unknown","location":"Tórshavn","abuse_type":"psychological","status":"new"}' \
|
||||||
| sed -n 's/.*"id":"\([^"]*\)".*/\1/p')
|
| sed -n 's/.*"id":"\([^"]*\)".*/\1/p')
|
||||||
|
|
||||||
curl -s -X PUT "http://localhost:8080/api/v1/registrations/$CREATED_ID" \
|
curl -s -X PUT "https://go-api.poc.fló.fo/api/v1/registrations/$CREATED_ID" \
|
||||||
-H "Authorization: $ADMIN_TOKEN" \
|
-H "Authorization: $ADMIN_TOKEN" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{"gender":"female","location":"Skopun","abuse_type":"digital","status":"referred"}'
|
-d '{"gender":"female","location":"Skopun","abuse_type":"digital","status":"referred"}'
|
||||||
|
|
||||||
curl -s -X DELETE "http://localhost:8080/api/v1/registrations/$CREATED_ID" \
|
curl -s -X DELETE "https://go-api.poc.fló.fo/api/v1/registrations/$CREATED_ID" \
|
||||||
-H "Authorization: $ADMIN_TOKEN"</code></pre>
|
-H "Authorization: $ADMIN_TOKEN"</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
@@ -108,35 +108,35 @@ curl -s -X DELETE "http://localhost:8080/api/v1/registrations/$CREATED_ID" \
|
|||||||
<span>Windows / PowerShell</span>
|
<span>Windows / PowerShell</span>
|
||||||
</summary>
|
</summary>
|
||||||
<div class="workflow-content">
|
<div class="workflow-content">
|
||||||
<h3>Reader user — filtered reads</h3>
|
<h3>Reader user examples</h3>
|
||||||
<pre><code>$reader = Invoke-RestMethod `
|
<pre><code>$reader = Invoke-RestMethod `
|
||||||
-Method Post `
|
-Method Post `
|
||||||
-Uri "http://localhost:8080/login" `
|
-Uri "https://go-api.poc.fló.fo/login" `
|
||||||
-ContentType "application/json" `
|
-ContentType "application/json" `
|
||||||
-Body '{"user_name":"reader","password":"reader-password"}'
|
-Body '{"user_name":"reader","password":"reader-password"}'
|
||||||
|
|
||||||
$READER_TOKEN = $reader.token
|
$READER_TOKEN = $reader.token
|
||||||
|
|
||||||
Invoke-RestMethod `
|
Invoke-RestMethod `
|
||||||
-Uri "http://localhost:8080/api/v1/registrations?location=Tórshavn&limit=5" `
|
-Uri "https://go-api.poc.fló.fo/api/v1/registrations?location=Tórshavn&limit=5" `
|
||||||
-Headers @{Authorization=$READER_TOKEN}
|
-Headers @{Authorization=$READER_TOKEN}
|
||||||
|
|
||||||
Invoke-RestMethod `
|
Invoke-RestMethod `
|
||||||
-Uri "http://localhost:8080/api/v1/registrations?gender=female&abuse_type=psychological&status=open&limit=10" `
|
-Uri "https://go-api.poc.fló.fo/api/v1/registrations?gender=female&abuse_type=psychological&status=open&limit=10" `
|
||||||
-Headers @{Authorization=$READER_TOKEN}
|
-Headers @{Authorization=$READER_TOKEN}
|
||||||
|
|
||||||
Invoke-RestMethod `
|
Invoke-RestMethod `
|
||||||
-Uri "http://localhost:8080/api/v1/registrations?from=1989-01-01&to=1990-01-01&offset=20&limit=10" `
|
-Uri "https://go-api.poc.fló.fo/api/v1/registrations?from=1989-01-01&to=1990-01-01&offset=20&limit=10" `
|
||||||
-Headers @{Authorization=$READER_TOKEN}
|
-Headers @{Authorization=$READER_TOKEN}
|
||||||
|
|
||||||
Invoke-RestMethod `
|
Invoke-RestMethod `
|
||||||
-Uri "http://localhost:8080/api/v1/locations" `
|
-Uri "https://go-api.poc.fló.fo/api/v1/locations" `
|
||||||
-Headers @{Authorization=$READER_TOKEN}</code></pre>
|
-Headers @{Authorization=$READER_TOKEN}</code></pre>
|
||||||
|
|
||||||
<h3>CRUD user — create, update, delete</h3>
|
<h3>CRUD user — create, update, and delete examples</h3>
|
||||||
<pre><code>$admin = Invoke-RestMethod `
|
<pre><code>$admin = Invoke-RestMethod `
|
||||||
-Method Post `
|
-Method Post `
|
||||||
-Uri "http://localhost:8080/login" `
|
-Uri "https://go-api.poc.fló.fo/login" `
|
||||||
-ContentType "application/json" `
|
-ContentType "application/json" `
|
||||||
-Body '{"user_name":"admin","password":"admin-password"}'
|
-Body '{"user_name":"admin","password":"admin-password"}'
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ $ADMIN_TOKEN = $admin.token
|
|||||||
|
|
||||||
$created = Invoke-RestMethod `
|
$created = Invoke-RestMethod `
|
||||||
-Method Post `
|
-Method Post `
|
||||||
-Uri "http://localhost:8080/api/v1/registrations" `
|
-Uri "https://go-api.poc.fló.fo/api/v1/registrations" `
|
||||||
-Headers @{Authorization=$ADMIN_TOKEN} `
|
-Headers @{Authorization=$ADMIN_TOKEN} `
|
||||||
-ContentType "application/json" `
|
-ContentType "application/json" `
|
||||||
-Body '{"gender":"unknown","location":"Tórshavn","abuse_type":"psychological","status":"new"}'
|
-Body '{"gender":"unknown","location":"Tórshavn","abuse_type":"psychological","status":"new"}'
|
||||||
@@ -153,14 +153,14 @@ $CREATED_ID = $created.id
|
|||||||
|
|
||||||
Invoke-RestMethod `
|
Invoke-RestMethod `
|
||||||
-Method Put `
|
-Method Put `
|
||||||
-Uri "http://localhost:8080/api/v1/registrations/$CREATED_ID" `
|
-Uri "https://go-api.poc.fló.fo/api/v1/registrations/$CREATED_ID" `
|
||||||
-Headers @{Authorization=$ADMIN_TOKEN} `
|
-Headers @{Authorization=$ADMIN_TOKEN} `
|
||||||
-ContentType "application/json" `
|
-ContentType "application/json" `
|
||||||
-Body '{"gender":"female","location":"Skopun","abuse_type":"digital","status":"referred"}'
|
-Body '{"gender":"female","location":"Skopun","abuse_type":"digital","status":"referred"}'
|
||||||
|
|
||||||
Invoke-RestMethod `
|
Invoke-RestMethod `
|
||||||
-Method Delete `
|
-Method Delete `
|
||||||
-Uri "http://localhost:8080/api/v1/registrations/$CREATED_ID" `
|
-Uri "https://go-api.poc.fló.fo/api/v1/registrations/$CREATED_ID" `
|
||||||
-Headers @{Authorization=$ADMIN_TOKEN}</code></pre>
|
-Headers @{Authorization=$ADMIN_TOKEN}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user