Onboarding

If your are unfamiliar with our web-based-portal (https://portal.onlyonce.com) or if you just want to sync the data your network has shared with you to your own backend you can use our v2-API.


Let's create a brand new user (use our beta environment for testing!!)

In Node.js :

var request = require("request");

var options = { method: 'POST',
  url: 'https://apibeta.onlyonce.com/v2/signUp',
  headers: 
   { 'content-type': 'application/json'
  body: 
   { passPhrase: '12341234',
     password: '12341234',
     email: '12341234@zdevops.com',
     firstName: 'Een Twee Drie Vier',
     middleName: 'hoedje_van_hoedje_van',
     lastName: 'Papier',
     personalEmail: '1234@hoedjevanpapier.com',
     personalPhone: '+318812341234'
    }
  json: true };

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

  console.log(body);
});

  

What?

We seem to need more input fields than that?

{
  "status": "registration-failed",
  "data": {
    "fields": [
      "country"
    ]
  }
}
  

So we need to add a country too? This is a fixed field in the Only Once platform so you need to look it up via /dictionaries?fieldDefinitionName=country.

Once you retrieve country and gender you can add them to the body of your signup-request.

var request = require("request");

var options = { method: 'POST',
  url: 'https://apibeta.onlyonce.com/v2/signUp',
  headers: 
   { 'content-type': 'application/json'
  body: 
   { passPhrase: '12341234',
     password: '12341234',
     email: '12341234@zdevops.com',
     firstName: 'Een Twee Drie Vier',
     middleName: 'hoedje_van_hoedje_van',
     lastName: 'Papier',
     personalEmail: '1234@hoedjevanpapier.com',
     personalPhone: '+318812341234'
     country: '64a26eb4-7e0d-43e0-a993-1b1535da1d63',
     gender: 'c5e1dc28-f0f8-4f72-9a2a-1ff20ece7eef'
    }
  json: true };

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

  console.log(body);
});

  

If all ends well you should be rewarded with an HTTP 200 and a totally empty body

Presto we created a user!

Now that we have a user account on the platform (verify email?) it's time to logon

var request = require("request");

var options = { method: 'POST',
  url: 'https://apibeta.onlyonce.com/v2/signIn',
  headers: { 'content-type': 'application/json' },
  body: { username: '12341234@zdevops.com', password: '12341234' },
  json: true };

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

  console.log(body);
});

This should return us our JWT-token we can use in other calls to the platform such as

  • Getting information about my profiles
© 2016-2017, All rights reserved, Only Once (version 0.90.22, 2017-05-22).