OneOffice Logo

Enterprise

Integrating an External Application for Enterprise

IMPORTANT: For legibility the "\" at the end of each line were removed

Creating customer -- before they buy for first time

Request

curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
  "method":"createCustomer",
  "params": {
    "id":"ABC",
    "name":"ABC Company",
    "admin": {
      "email":"test3@example.com",
      "phone":"111111111", 
      "displayName": "Isa Aswath"
    }
  }
}' 

Notes

  1. You send us your internal id ("ABC") and we return it as "remoteId" in response.
  2. You can safely ignore "id" in the returned body, this is our internal primary key in the customers table.
  3. We will not send any emails out, so you can test safely.

Response

STATUS: 200
BODY:
{
  "name":"ABC Company",
  "partner":0,
  "createdAt":1684313717,
  "id":1,
  "isActive":true,
  "admin":{"email":"test3@example.com"},
  "remoteId":"ABC"
}

Creating first order (i.e. createInstance)

Request

curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
  "method":"createFirstOrder",
  "params": {
    "customer":"ABC",
    "id":"REMOTEORDER1",
    "product":"oo-lite",
    "licenses":20,
    "duration":"monthly"
  }
}'

Notes

  1. "customer" the id you sent us in the "createCustomer" request
  2. "id" is the order in your tables -- in the case of the first order, this is the parent order, you will send that in subsequent requests
  3. "products" can be any of oo-lite, oo-std, oo-ent, erp-std, erp-admin, erp-lim
  4. "duration" can be any of monthly or yearly

Creating renewal orders (i.e. renewInstance)

Request

curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
  "method":"createRenewalOrder",
  "params": {
    "parent":"REMOTEORDER1",
    "id":"REMOTEORDER2"
    }
  }'

Notes

  1. "parent" is the first order -- stays the same for all renewals
  2. "id" is the current order, each new renewal will have a different order
  3. you cannot renew an order if more than 15 days left on current term (we can change if you want) - this also avoids repeated requests by mistake
  4. if a previous order expired, we start the term from the current date, otherwise from the end of current term

Cancelling orders (i.e. deleteInstance)

Request

curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
  "method":"cancelOrder",
  "params":{
    "id":"REMOTEORDER1"
  }
}'

Notes

  • The only parameter is your id of the first order

Suspending orders

Request

curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
  "method":"suspendOrder",
  "params":{
    "id":"REMOTEORDER1"
  }
}'

Notes

  • The only parameter is your id of the first order