Juicebox Embedding API
Here are the relevant API calls
To embed Juicebox apps in your own website, follow these steps.
Request a JWT token as a client admin user. This token can be reused.
Request details about what Juicebox apps are available. This will provide you an app id for the app you want to embed.
Request an embed url for this user to see the app.
Serve the embed url in an iframe on your site.
Let's look at the details for each of these steps.
Request a JWT token for a Client Admin user
GET https://{domain}.myjuicebox.io/api/v1/jb/api-token-auth/
Request a token that represents a client admin user. This user has permissions to perform user setup and request embed urls for your Juicebox account.
Path Parameters
Find the app you want the user to be able to see.
Request list of available apps
GET https://{domain}.myjuicebox.io/api/v1/jb/apps/
Get a list of all available apps. Juicebox apps have both a published and draft version. The draft version will only be visible to editors and admins.
Handling Pagination
If the number of available apps exceeds 100, the list of apps will be paginated. Response headers will contain the following values.
X-Count The total number of apps available.
X-PageThe current page number
X-PageSize The number of apps on each page.
X-Next A link to fetch the next page of data. This will be "None" when on the last page of data.
X-Previous A link to fetch the previous page of data. This will be "None" when on the first page of data.
Path Parameters
"JWT {token}"
A JWT token for a client admin user.
Create a user with the Juicebox Data Permissions and app access you desire.
POST https://{domain}.myjuicebox.io/api/v1/jb/users/
Path Parameters
"JWT {token}"
A JWT token for a client admin user.
The email address of the user you want to create.
A Juicebox Data Permissions object to control what this user can see. If omitted, the user will not have any data permissions applied.
A list of app ids that this user is allowed to see.
Now you can request an app embed url.
Request an app embed url for a user
POST https://{domain}.myjuicebox.io/api/v1/jb/apps/{appid}/embed/{email}/
For security, the default duration of an embed url is 60 seconds. It can only be loaded once. It can be regenerated as many times as needed.
Path Parameters
An app id for an app this user has access to.
An email for a user that has already been created.
Query Parameters
If this parameter is present in the query string, the application header (which allows export as png and pdf) will be displayed.
Turn off display of the header with ?show_header=0
If this parameter is present in the query string, the application footer will be displayed.
Turn off display of the header with ?show_footer=0
"JWT {token}"
A JWT token for a client admin user.
Serving the app in an iframe. To embed the app in your site, use the following html. You can vary height and width as appropriate for your site.