Cubicasa Partner API v0.65
This is a description for Partner API interface for handling new Orders and delivery status.
Authentication
The service users Bearer HTTP authentication scheme. A client wanting to access to the service is required to locate a control server trusted by that service, authenticate itself with an opaque long lived token. The opaque token is delivered using HTTP authentication headers to the HTTP service which grants or denies access.
Authorization: Bearer 5262d64b892e8d4341000001
API Specification
Orders ¶
Available functionalities: create new Order, get Order status
Create order ¶
Create New OrderPOST/orders
Create a new order
Request properties
sources: source materials you have, don't be shy, just take a photo of your drawing on a paper
address: address of the location you model
area: size of the model in m2
type: type of model is either "floor-plan" or "premium"
info: any extra info for us to help deliver what you need
market: language settings, use "fi" for Finnish and "en-us" for American English
unit: Unit in meter or feet
style: furniture style. We currently offer "office", "scandinavian", "french" and "country"
color: color of walls on the model (use hex color codes, ie. #fffff)
logoUrl: address of your custom logo to be included in the model
Example URI
Headers
Content-Type: application/json
Authorization: Bearer 5262d64b892e8d4341000001
Body
{
"sources": [
"https://urltomatrialimage.hosting.com"
],
"address": {
"country": "Finland",
"state": "Oulu",
"zip": "90100",
"streetName": "Aleksanderinkatu",
"suite": "21"
},
"specification": {
"area": "120",
"type": "premium",
"info": "additional info about this plan",
"market": "FI",
"unit": "ft",
"style": "scandinavian",
"color": "0x000",
"logoUrl": "https://urltomatrialimage.hosting.com"
},
"options": {
"delivery": {
"email": "deliver.here@example.com"
}
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {
"sources": {
"id": "http://jsonschema.net/sources",
"type": "array",
"minItems": 1,
"items": {
"id": "sourceUri",
"type": "uri"
}
},
"address": {
"id": "address",
"type": "object",
"properties": {
"country": {
"id": "country",
"type": "string",
"default": "Finland",
"enum": [
null,
"Finland"
]
},
"state": {
"id": "state",
"type": "string",
"default": "Oulu",
"enum": [
null,
"Oulu"
]
},
"zip": {
"id": "zip",
"type": "string",
"default": "90100",
"enum": [
null,
"90100"
]
},
"streetName": {
"id": "streetName",
"type": "string",
"default": "Aleksanderinkatu",
"enum": [
null,
"Aleksanderinkatu"
]
},
"suite": {
"id": "suite",
"type": "string",
"default": "21",
"enum": [
null,
"21"
]
}
}
},
"specification": {
"id": "specification",
"type": "object",
"properties": {
"area": {
"id": "area",
"type": "string"
},
"type": {
"id": "type",
"type": "string",
"default": "floor-plan",
"enum": [
floor-plan,
"premium"
]
},
"info": {
"id": "info",
"type": "string",
"default": "additional info about this plan",
},
"market": {
"id": "market",
"type": "string",
"default": "FI",
"enum": [
"fi-FI",
"de-DE",
"en-US"
]
},
"unit": {
"id": "unit",
"type": "string",
"default": "ft",
"enum": ["m", "ft", "m, ft"]
},
"style": {
"id": "style",
"type": "string",
"default": "scandinavian",
"enum": [
"office",
"scandinavian",
"french",
"country"
]
},
"color": {
"id": "color",
"type": "string",
"default": "0x000"
},
"logoUrl": {
"id": "logoUrl",
"type": "uri"
}
}
},
"options": {
"id": "options",
"type": "object",
"properties": {
"delivery": {
"id": "delivery",
"type": "object",
"properties": {
"email": {
"id": "deliveryEmail",
"type": "string"
}
}
}
}
},
"required": [
"sources",
"address",
"specification"
]
}
201
400
Headers
Content-Type: application/json
Get order status ¶
Order description
Get Order StatusGET/orders/{id}
Get a single order.
Response properties
status: order status "order-placed", "order-in-production" or "order-ready"
delivery: optional return property with array of model urls. Attached to the response whenever order reaches status "order-ready"
Example URI
- id
string
(required) Example: 68a5sdf67The order ID
200
Headers
Content-Type: application/json
Body
{
"status": "order-in-production",
"ts": 1444729843996
}
404
Headers
Content-Type: application/json
Body
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred"
}
Fix Request ¶
Available functionalities: Send a fix request to an order
Create Fix Request ¶
Send a fix request to an orderPOST/orders/{id}/fixrequest
Use the json structure provided below in the post body.
Example:
{
text: "Your text for fix request."
}
Example URI
- id
string
(required) Example: 68a5sdf67The order ID
Headers
Content-Type: application/json
Authorization: Bearer 5262d64b892e8d4341000001
Body
{
"text": "My fix request text."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
}
201
Body
{
id: '561e69d4ccbafc0300a2f0cc',
timestamp: '1451144925'
message: 'Fix-request submitted'
}
500
Webhooks ¶
Use Webhooks to get notified about different stages of your order. You simply register an URL and select events you would like to hear about and we will notify that URL with changes. First available event is order-ready that notifies you when out team delivers the model.
Create webhook ¶
Create New WebhookPOST/webhooks
Create a new webhook. Webhook will be called with following POST body:
Example:
{
id: '561e69d4ccbafc0300a2f0cc',
delivery: [
'http://fi.cubicasa.s3.amazonaws.com/489d-4224-95b9_2D.jpg',
'http://fi.cubicasa.s3.amazonaws.com/cc21-4a87-a672_3D.jpg'
]
}
Options
events: order-ready
protocols: http, https
authentication: none
Example URI
Headers
Authorization: Bearer 5262d64b892e8d4341000001
Content-Type: application/json
Body
{
"url": "www.example.com/webhook",
"protocol": "http",
"specification": {
"events": [
"order-ready"
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {
"url": {
"id": "http://jsonschema.net/url",
"type": "string"
},
"protocol": {
"id": "http://jsonschema.net/protocol",
"type": "string"
},
"specification": {
"id": "http://jsonschema.net/specification",
"type": "object",
"properties": {
"events": {
"id": "http://jsonschema.net/specification/events",
"type": "array",
"items": {
"id": "http://jsonschema.net/specification/events/0",
"type": "string"
}
}
}
}
},
"required": [
"url",
"protocol",
"specification"
]
}
201
Body
{
id: '561e69d4ccbafc0300a2f0cc',
timestamp: '1451144925'
message: 'Webhook created successfuly'
}
400
Get own webhook ¶
Get own webhookGET/webhooks
Get own webhook
Example URI
Headers
Content-Type: application/json
Authorization: Bearer 5262d64b892e8d4341000001
Body
{
"url": "www.example.com/webhook",
"protocol": "http",
"specification": {
"events": [
"order-ready"
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {
"url": {
"id": "http://jsonschema.net/url",
"type": "string"
},
"protocol": {
"id": "http://jsonschema.net/protocol",
"type": "string"
},
"specification": {
"id": "http://jsonschema.net/specification",
"type": "object",
"properties": {
"events": {
"id": "http://jsonschema.net/specification/events",
"type": "array",
"items": {
"id": "http://jsonschema.net/specification/events/0",
"type": "string"
}
}
}
}
},
"required": [
"url",
"protocol",
"specification"
]
}
201
Body
{
"_id":"56a70e9e1ba9e6030090c3e3",
"url":"www.example.com/webhook",
"specification": {
"events": ["order-ready"]
},
"protocol":"http",
}
400
Update webhook ¶
Update a WebhookPUT/webhooks/
Update a single webhook
Request properties
events: order-ready
protocols: http, https
authentication: none
Example URI
Headers
Content-Type: application/json
Authorization: Bearer 5262d64b892e8d4341000001
Body
{
"url": "www.example.com/webhook",
"protocol": "http",
"specification": {
"events": [
"order-ready"
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {
"url": {
"id": "http://jsonschema.net/url",
"type": "string"
},
"protocol": {
"id": "http://jsonschema.net/protocol",
"type": "string"
},
"specification": {
"id": "http://jsonschema.net/specification",
"type": "object",
"properties": {
"events": {
"id": "http://jsonschema.net/specification/events",
"type": "array",
"items": {
"id": "http://jsonschema.net/specification/events/0",
"type": "string"
}
}
}
}
},
"required": [
"url",
"protocol",
"specification"
]
}
201
Body
{
id: '561e69d4ccbafc0300a2f0cc',
timestamp: '1451144925',
message: 'Webhook updated'
}
400