Running a Service

It's super easy to get started using a new service! Once you signup and get an API key, just copy and paste a code snippet and run it to get started.

const api = require('api').config('<<keys:api_key>>');

api('math')
  .run('add', { numbers: [1, 2, 3] })
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.error(err);
  });
import api

api = api.config('<<keys:api_key>>')

val, res = api('math').run('add', {
  'numbers': [1, 2, 3]
})
require 'api-build'

api = Build::Api.new
api.config('<<keys:api_key>>')
response = api.run('math','add', {
  :numbers => [1,2,3]
})

print response

Calling Private Services

If you've deployed a service privately, you need to prefix the service name with your team to call it. For example, if the team readme deployed a math service privately, it can be called with readme/math. This prevents clashes with any public packages that might have the same name.

const api = require('api').config('<<keys:api_key>>');

api('readme/math')
  .run('add', { numbers: [1, 2, 3] })
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.error(err);
  });
import api

api = api.config('<<keys:api_key>>')

val, res = api('readme/math').run('add', {
  'numbers': [1, 2, 3]
})
require 'api-build'

api = Build::Api.new
api.config('<<keys:api_key>>')
response = api.run('readme/math','add', {
  :numbers => [1,2,3]
})

print response

For more information on how deploy private services visit: Creating Private Services.