Basic Usage Flow

The most basic API calls towards the Only Once platform are mostly dealing with data interaction. The pull-down button above will show you examples and frameworks for various programming languages.

The basic usage flow consists of :

  • Retrieving an access token
  • Accept/Reject incoming data
  • Retrieve Data
    • Full Feed
    • Incremental Feed

In pseudo-code (using an imaginary framework) :

      import imagsdk

      lastSync = get_last_sync_from_db() or now()
      jwt = getJWT(username, password)
      feed = getfeed(jwt, since=lastSync, NETWORK_UPDATES)
      for update in feed
          print update

      # Auth from here
      doAUth(jwt, secretkey)

Logging on (retrieve JWT-token)

Mostly all calls to the Only Once API require a (temporary) access-token. This token is aqquired via the signIn endpoint.

/signIn [POST]
JSON in body
    "username" : string (required),
    "password" : string (required)
Returns 200 OK
[in header] Authorization -> Bearer eyJhbGci...

You've given invalid credentials

403 Forbidden
  "status": "access-denied"
JSON body missing or mal-formatted
Requires None

Exampje (Node.js)

var request = require("request");

var options = { method: 'POST',
  url: '',
  headers: { 'content-type': 'application/json' },
  body: { 
    username: '', 
    password: 'your secret password' 
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

© 2016-2017, All rights reserved, Only Once (version 0.90.22, 2017-05-22).