REST API - rettersoft/rbs-docs GitHub Wiki

RBS Service Rest Integration

What you need?

RBS is a middleware connecting rest services. You need

  • RBS project id
  • RBS service Id
  • Service secret token

in order to send messages to other services.

RBS messages are called actions. You can find more information about actions in this document: https://github.com/rettersoft/rbs-docs/wiki/Developing-a-service

Authentication

To send an action to RBS you need to create a JWT token signed with your secret in your manifest file. An example of creating a JWT in nodejs:

import jwt from 'jsonwebtoken'
 
let token = jwt.sign({
   projectId: "050fa5fc8828440ea8a7d04bd854f574",
   identity: 'rbs.cargo',
}, 'somesecretkey', {
   expiresIn: "2 days"
})

Token should include identity and projectId.

Identity is the id of your service. Project id is the id of project you are sending the action to.

You can find a SDK to create JWT tokens in any programming language in jwt.io.

API

RBS api url is: https://core.rtbs.io

RBS actions can have 3 different types:

  • request
  • event
  • get

Request and Event actions

request and event types should be sent with HTTP POST method to API.

Example request action:

rbs.pimproduct.request.UPDATE

https://core.rtbs.io/service/action/{{projectId}}/rbs.pimproduct.request.UPDATE?auth={JWT}

Body should be sent in post body. Body can be found in action documentation for each action.

Get actions

get actions should be sent with GET http method.

Example get action:

rbs.storage.get.IMAGE

https://core.rtbs.io/service/action/{{projectId}}/rbs.storage.get.IMAGE?auth={JWT}&data={{base64_encoded_body}}

Input body of a get action should be base64 encoded and put as a query string parameter called data.