Links

Assets API

This reference describes the Instruqt Assets API and helps you get started.

What is the Assets API?

The Instruqt Assets API lets you store track specific files on the platform - assets. Assets API is HTTP based and in order to consume it you must have a valid authentication token(will be referred as token on this page).
The API supports uploading, fetching and getting information about your asset.

Uploading asset

Request

HTTP Method: POST URL: https://play.instruqt.com/assets/tracks/track_id
  • track_id - id of a track asset belongs to

Request headers

Name
Value
Authorization
Bearer token

Response

Asset MD5 hash value encoded to string will be returned in response body.

Fetching asset

Request

HTTP Method: GET URL: https://play.instruqt.com/assets/tracks/track_id/asset_hash
  • track_id - id of a track asset belongs to
  • asset_hash - MD5 sum of an asset

Request headers

Name
Value
Authorization
Bearer token

Response

Asset will be returned in response body as a binary stream.
Response headers
Name
Value
Content-Length
Size of a requested asset in bytes
Content-Type
Content-type of an asset, f.e. image/png

Asset info

Request

HTTP Method: HEAD URL: https://play.instruqt.com/assets/tracks/track_id/asset_hash
  • track_id - id of a track asset belongs to
  • asset_hash - MD5 sum of an asset

Response

Empty

Response headers

Name
Value
Content-Length
Size of a requested asset in bytes

HTTP status codes

Code
Meaning
200
Request was successful
404
Requested asset not found
500
Internal Instruqt error or error in the underlying storage.

Usage of uploaded assets

You can refer to an uploaded asset inside a markdown using the same URL which is used to fetch an uploaded asset
https://play.instruqt.com/assets/tracks/track_id/asset_hash

Embed an image into the assignment text

This example embeds an image in the assignment.md sidebar text. This is useful for showing a screenshot or other image to your learner as part of the challenge instructions:
YAML/Markdown
---
slug: my-challenge
id: un6vygpcp3mj
type: challenge
title: My Challenge
tabs:
- title: Google tab
type: website
url: https://google.com
difficulty: basic
timelimit: 600
---
Hello there, assets!
![Image Description](https://play.instruqt.com/assets/tracks/mk9ukiebswjx/ed965e981aa26d375329f4bd1575bc49)