I hit a few hurdles getting my first API request to work in Postman so I figured I would throw together a quick guide for anyone that wants to try out the API but isn’t a developer or doesn’t want to use cURL.
Getting your API token
This process will very likely change in the future but for now:
- Open a tab to your https://YOUR_ACCOUNT_HERE.fibery.io/ page
- Open the developer console by pressing
F12
orCmd+Opt+J
on Mac (more info here) - Paste in the code below (WARNING: you should never run unknown console commands, the one below is copy pasted from the official API)
fetch(`https://${window.location.host}/api/tokens`, { method: 'POST' })
.then(res => res.json())
.then(obj => console.log("Your API token:", obj.value));
- If your token isn’t printed in the console you might have to click on one of the messages to see it. End result should look something like below. Temporarily copy your API token somewhere secure.
Setting up Fibery authentication in your Postman collection
-
Create a new collection in Postman
-
In the Authorization tab, for Type select API Key for Key enter
Authorization
, for Value enterToken {{token}}
and Add to should be Header
-
Head over to the Variables tab and create a new Variable
token
with the Initial Value set to whatever your API token was
-
Click Save
Sending an API request
- Create a new request in your Fibery collection and under the requests Authorization tab make sure the Type is set to Inherit auth from parent
- a) Set the request type to POST, b) set the request URL to
https://YOUR_ACCOUNT_HERE.fibery.io/api/commands
and c) under Headers tab add a header with the Key ofContent-Type
and a Value ofapplication/json
- Head over to the request’s Body tab and select raw. You should now be able to enter and send your API request. For example, here is how you get the schema: