API Access#
The FoundriesFactory™ Platform APIs can be accessed via two methods:
OAuth2 tokens managed in the Application Credentials interface.
API Tokens managed in the API tokens interface.
These credentials allow users to access:
Using the HTTP header
OSF-TOKEN: <token>.Using an OAuth2 bearer token
Authorization: Bearer <access-token>Git repositories. Access is granted by passing an API token as the password to Git clone and fetch operations.
Factory containers. Access is granted by passing an API token as the password to
docker login hub.foundries.io.Fioctl® uses OAuth2 by default, but can also use API Tokens.
All tokens are created with scopes to help limit what they can do.
Note
Fioctl has a Docker Credential Helper which simplifies access to
hub.foundries.io.
Common Scopes#
Some common scopes you may find useful include:
source:read-update: For Git.
targets:read, devices:read, ci:read: Read-only access for Fioctl or REST API.
targets:read-update, devices:read-update, ci:read: Read-update access for Fioctl.
containers:read: For running docker commands on Factory containers.
Token Scopes#
Scopes define what resources a given token may perform operations on. The following scopes are supported:
Source#
source:readCan perform git clone/fetch/pull operations.
source:read-updateCan perform git push operations.
source:deleteCan delete a reference (
git push --delete ...) and force-push (git push -f).source:createCan create a new references (tags and branches).
Containers#
containers:readCan
docker pull.containers:read-updateCan
docker push.
CI#
ci:readCan access CI builds
https://api.foundries.io/projects/<factory>/lmp/.ci:read-updateThis is not usually needed as
source:read-updatetriggers the CI. However, custom use-cases that trigger CI builds viahttps://api.foundries.io/projects/<factory>/lmp/builds/may use this.
Devices#
devices:readCan view device(s)
https://api.foundries.io/ota/devices/.devices:read-updateCan update configuration on a device
https://api.foundries.io/ota/devices/<device>/config/devices:createCan create a device (
lmp-device-registerwith an API token).devices:deleteCan delete a device
https://api.foundries.io/ota/devices/<device>/
Targets#
targets:readCan view
targets.jsonhttps://api.foundries.io/ota/factories/<factory>/targets/.targets:read-updateCan update
targets.jsonhttps://api.foundries.io/ota/factories/<factory>/targets/.