Tutorial

This is a step-by-step tutorial to create an order with the ERP service. We go from creating a bureau to an order while looking at some of the model printability and material volume estimate features.

Bureau

To create a bureau the following fields need to be passed: name, description (optional), group.

Example request

POST https://erp.authentise.com/bureau/
Content-Type: application/json

{
    "name"          : "Authentise Bureau",
    "description"   : "This is one of the bureaus Authentise supports",
    "group"         : "https://users.authentise.com/groups/00000000-0000-0000-0000-00000000group/"
}
Location: https://erp.authentise.com/bureau/00000000-0000-0000-0000-000000bureau/

This will help create a bureau with name “Authentise Bureau”. We can obtain the URI of the bureau from the Location field in response headers.

Location

Once a bureau is created we would need a location. The location identifies an office where a bureau might maintain stock, process orders from customers or ship out finished goods. To create a location the following fields are needed to be passed: name, phone, address, contact, bureau.

Example request

POST https://erp.authentise.com/location/
Content-Type: application/json

{
    'name'    : 'West',
    'phone'   : '1-800-000-0000',
    'address' : '41522 Carol st, San Francisco, CA, 94321, USA',
    'contact' : 'https://users.authentise.com/users/00000000-0000-0000-0000-000000000user/',
    'bureau'  : 'https://erp.authentise.com/bureau/00000000-0000-0000-0000-000000bureau/',
}
Location: https://erp.authentise.com/location/00000000-0000-0000-0000-000000location/

This will help create a location with name “West”. We can obtain the URI of the bureau from the Location field in response headers.

Manufacturer

After we have a location resource created, we will now go ahead and create a manufacturer. A manufacturer represents an organization that creates several resources like material, printer, post processor etc. To create a manufacturer the following fields are needed: name, address, notes, contact, support.

Example request

POST https://erp.authentise.com/manufacturer/
Content-Type: application/json

{
    'name'      : 'West-1',
    'address'   : '41522 Carol st, San Francisco, CA, 94321, USA',
    'notes'     : 'West-1 respresents a printer created.',
    'contact'   : {
        'name'  : 'John Smith',
        'phone' : '123-123-1234',
    },
    'support'   : {
        'name'  : 'Fred Smith',
        'phone' : '123-123-1234',
    },
}
Location: https://erp.authentise.com/manufacturer/00000000-0000-0000-0000-000manufacturer/

This will help create a manufacturer with name “West-1”. We can obtain the URI of the manufacturer from the Location field in response headers.

Currency Conversion

This is of of the most important resource of ERP which deals with currency conversions for the currencies. There are the currency conversion values that the bureau decides for each currencies. This then has a vital role in calculating the estimated order cost. To create a /currency-conversion/ resource we will need: bureau, currency and value.

Example request

POST https://erp.authentise.com/currency-conversion/
Content-Type: application/json

{
    'bureau'    : 'https://erp.authentise.com/bureau/00000000-0000-0000-0000-000000bureau/',
    'currency'  : 'USD',
    'value'     : 1,
}
Location: https://erp.authentise.com/currency-conversion/00000000-0000-0000-currency-conversion/

Similarly this bureau might have currency-conversions for other currencies like:

Currency Conversion
Currency Conversion
EUR 0.9353
GBP 0.8038
JPY 109.23
USD 1

Plase NOTE: A bureau-currency relation for a currency-conversion is unique. A bureau will not be able to have two different values for ‘USD’.

Material

Now that we have a manufacturer, we can go ahead and create material. A material resource represents some kind of product that can be used to create digitally manufactured goods. To create material we need: name, description, color, type, retail_price (amount per unit volume in cc), post_processing_seconds, third_party_filfillment, manufacturer.

Example request

POST https://erp.authentise.com/material/
Content-Type: application/json

{
    'name'         : 'ABS',
    'description'  : 'The material is shiny',
    'color'        : '#FFFFFF',
    'type'         : 'support',
    'retail_price' : {
        'currency' : 'USD',
        'amount'   : 0.03,
    },
    'post_processing_seconds' : 100,
    'third_party_fulfillment' : True,
    'manufacturer'            : 'https://erp.authentise.com/manufacturer/00000000-0000-0000-0000-000manufacturer/',
}
Location: https://erp.authentise.com/material/00000000-0000-0000-0000-supportmaterial/

The concept of amount for the material is the amount per unit volume in cc. This amount is a multiplier. When it is multiplied with the currency-conversion for the currency provided for the order, it will give us the exact cost of the material per unit volume in cc. In the above material resource the exact cost of ABS per unit volume in cc in USD as supported by one of the bureau in the currency-conversion resource above would be: 0.03*1 = $0.03.

It is important to bear in mind that the amount for a material is a multiplier which will give us the actual cost for a currency when multiplied by the currency-conversion.

Let us create one more material that can be used as a base material when we are about to create orders.

Example request

POST https://erp.authentise.com/material/
Content-Type: application/json

{
    'name'         : 'ABS',
    'description'  : 'The material is shiny',
    'color'        : '#FAAFFF',
    'type'         : 'base',
    'retail_price' : {
        'currency' : 'USD',
        'amount'   : 0.04,
    },
    'post_processing_seconds' : 100,
    'third_party_fulfillment' : True,
    'manufacturer'            : 'https://erp.authentise.com/manufacturer/00000000-0000-0000-0000-000manufacturer/',
}
Location: https://erp.authentise.com/material/00000000-0000-0000-0000-base00material/

Please NOTE: The retail price amount is the unit amount for that material per cc volume of that material. For the above two materials, ABS support is $0.03 per cc and ABS base is $0.04 per cc.

Third Party

ERP allows third party provider to be created. This administers information about a third party. It just needs a name and description as of now.

Example request

POST https://erp.authentise.com/third-party/
Content-Type: application/json

{
    'name'         : 'Authentise Third Party',
    'description'  : 'The is a third party provider',
}
Location: https://erp.authentise.com/third-party/00000000-0000-0000-0000-thirdparty/

Shipping

ERP allows shipping resource to be created. This administers the shipping type provided for a bureau in a region. The regions supported as of now are: Asia, Europe and North-america. Every shipping type has a cost associated with it. To create shipping resource we will need: bureau, cost, region, name, description.

Example request

POST https://erp.authentise.com/shipping/
Content-Type: application/json

{
    'bureau'        : 'https://erp.authentise.com/bureau/00000000-0000-0000-0000-000000bureau/',
    'cost'          : 10.25,
    'region'        : 'asia',
    'name'          : 'Standard Shipping',
    'description'   : 'Standard Shipping within Asia',
}
Location: https://erp.authentise.com/shipping/00000000-0000-0000-0000-shipping/

The cost of shipping is a term of particular importance. It is basically a unit multiplier that will give you the amount in currency when multiplied with currency-conversion. For the above shipping resource, the calculated total shipping amount for an Order using each currency-conversion would be as follows:

Currency Conversion
Currency Conversion Shipping cost(Unit multiplier) Total Shipping cost(Conversion * Shipping cost)
EUR 0.9353 10.25 9.5868
GBP 0.8038 10.25 8.2389
JPY 109.23 10.25 1120
USD 1 10.25 10.25

Model Printability

Order

We have the essential resources ready to create an order for print. We need model, bureau , currency, material and third_party_provider (optional) to create an order. In addition to these resources a bureau should have currency-conversion and shipping resources that it supports. These will later be used in doing estimates for the Order.

We will see different scenarios that also demonstrates model printability while creating order.

  1. When model GET has this response:

    GET https://models.authentise.com/model/00000000-0000-0000-0000-000000model/
    Content-Type: application/json
    
    {
        'status'        : 'processed',
        'analyses'      : {
            'manifold'  : True,
        },
        'size'          : {
            'x' : 20.0,
            'y' : 30.0,
            'z' : 10.0,
        }
    }
    

A model is processed and is a manifold. It also has its size available. Such a model is considered good for creating an order.

Example order request

POST https://erp.authentise.com/order/
Content-Type: application/json

{
    'name'      : 'Authentise Order',
    'model'     : 'https://models.authentise.com/model/00000000-0000-0000-0000-000000model/',
    'bureau'    : 'https://erp.authentise.com/bureau/00000000-0000-0000-0000-000000bureau/',
    'currency'  : 'USD',
    'materials' : {
        'base'  : 'https://erp.authentise.com/material/00000000-0000-0000-0000-base00material/',
        'suport':' https://erp.authentise.com/material/00000000-0000-0000-0000-supportmaterial/'
    },
    'quantity'  : 3,
    'third_party_provider' : 'https://erp.authentise.com/third-party/00000000-0000-0000-0000-thirdparty/'
}
Location: https://erp.authentise.com/order/00000000-0000-0000-0000-000000order/
  1. When the user does not have access for the model.

    GET https://models.authentise.com/model/00000000-0000-0000-0000-000000model/
    Content-Type: application/json
    
    {
        'message' : "Unauthorized",
        'status'  : "error"
    }
    

The same order POST as above will have the response with an error instead of Location.

Example order request

POST https://erp.authentise.com/order/
Content-Type: application/json

errors: [{
    'code' : 'Unauthorized',
    'title': 'Unable to get authorization for the model URI, https://models.authentise.com/model/00000000-0000-0000-0000-000000model/. Try providing another model
        you have authorization for.'
}]
  1. When the model status is not processed. If the status is any of these: [“error”, “inoperable”, “not-uploaded”, “processing”]

    GET https://models.authentise.com/model/00000000-0000-0000-0000-000000model/
    Content-Type: application/json
    
    {
        'status'        : 'not-uploaded',
        'analyses'      : {
            'manifold'  : None,
        },
        'size'          : {
            'x' : None,
            'y' : None,
            'z' : None,
        }
    }
    

The same order POST as above will have the response with an error instead of Location.

Example order request

POST https://erp.authentise.com/order/
Content-Type: application/json

errors: [{
    'code': 'ModelPrintability',
    'title': 'The model status of the model URI, https://models.authentise.com/model/00000000-0000-0000-0000-000000model/,
          has not-uploaded status. It needs to have the "processed" status in order to process the layout.'
}]
  1. When the model is not a manifold.

    GET https://models.authentise.com/model/00000000-0000-0000-0000-000000model/
    Content-Type: application/json
    
    {
        'status'        : 'processed',
        'analyses'      : {
            'manifold'  : False,
        },
        'size'          : {
            'x' : 20.0,
            'y' : 30.0,
            'z' : 10.0,
        }
    }
    

The same order POST as above will have the response with an error instead of Location.

Example order request

POST https://erp.authentise.com/order/
Content-Type: application/json

errors: [{
    'code': 'ModelPrintability',
    'title': 'The model analyses of model URI, https://models.authentise.com/model/00000000-0000-0000-0000-000000model/,
        shows that it is a "non-manifold" model. The model will not have a 100 percent printability confidence. We suggest to
        repair the model to be a "manifold" and try creating the order again.'
}]
  1. When the model size is not available.

    GET https://models.authentise.com/model/00000000-0000-0000-0000-000000model/
    Content-Type: application/json
    
    {
        'status'        : 'processed',
        'analyses'      : {
            'manifold'  : True,
        },
    }
    

The same order POST as above will have the response with an error instead of Location.

Example order request

POST https://erp.authentise.com/order/
Content-Type: application/json

errors: [{
    'code': 'ModelPrintability',
    'title': 'Unable to get the "size" from the model URI, https://models.authentise.com/model/00000000-0000-0000-0000-000000model/,
         because the response did not contain the "size" property. Please supply a model URI that can respond to a GET request with a JSON body
         including a "size" field.'
    }]

We see that model printability highly depends on the model parameters. Only case one successfully creates an order. Other cases suggests the model is not printable and asks for another model that can be used to create the order.

Estimates for an order

Once an order resource is created passing the model printability tests, the order calculates estimates. The estimates are calculated by slicing the model using a Cataylst engine. The configurations used for slicing are:

{
    "infill_speed"      : 40.0,
    "bed_size_x_r"      : 200.0,
    "bed_size_y"        : 200.0,
    "bed_shape"         : "rectangular",
    "bed_temperature"   : 0.0,
    "extruder_temperature": 230.0,
    "filament_diameter" : 1.75,
    "infill_density"    : 20.0,
    "layer_height"      : null,
    "nozzle_diameter"   : 0.4,
    "part_interior"     : "sparse",
    "perimeters"        : 2,
    "perimeter_speed"   : 40.0,
    "print_quality"     : "standard",
    "scale"             : 1,
    "support_style"     : "sparse",
    "units"             : "mm",
}

With the above slicing configurations, the material volume(in cc) is estimated. This is then used to calculate the cost of the order.

We can view the estimates if we do a GET on /order/ resource.

GET https://erp.authentise.com/order/00000000-0000-0000-0000-000000order/
Content-Type: application/json

{
    'bureau'    : 'https://erp.authentise.com/bureau/00000000-0000-0000-0000-000000bureau/',
    'created'   : "2016-11-02T18:47:58.176307",
    'currency'  : 'USD',
    'estimates' : {
        'print_time'    : 123,
        'cost'          : {
            'amount'    : 6.2454,
            'shipping_amount'   : None,
        },
        'materials': {
            'support'   : 1.5731616,
            'base'      : 50.8655584
        }
    },
    'name'      : 'Authentise Order',
    'model'     : 'https://models.authentise.com/model/00000000-0000-0000-0000-000000model/',
    'materials' : {
        'base'  : 'https://erp.authentise.com/material/00000000-0000-0000-0000-base00material/',
        'suport':' https://erp.authentise.com/material/00000000-0000-0000-0000-supportmaterial/'
    },
    'shipping'  : {
        'name'      : null,
        'tracking'  : null,
        'uri'       : null,
        'address'   : null
    },
    'quantity'  : 3,
    'third_party_provider' : 'https://erp.authentise.com/third-party/00000000-0000-0000-0000-thirdparty/'
    'uri'       : "https://erp.authentise.com/order/00000000-0000-0000-0000-000000order/",
}

The order resource has a field estimates. This field contains the support material and base material volume estimates(in cc) for the model in an order. The field cost contains the cost estimate for the order quantity. The currency is the currency of the materials used in the order resource. The amount is calculated with the retail amount per unit cc as mentioned in the material resource. If the support material for an order is not provided, the total cost estimate is calculated with base material retail amount.

Shipping Estimates

We see that the order above has an estimate for how much will be the total cost for printing the order. Now we will see how an order estimates the shipping amount. For this an order requires a shipping URI. If we observe the above order, we see that there in no information for what kind of shipping does the user wants. Shipping preference like name, address can be provided by the user. The user can also specify the shipping URI. This is the shipping options available for the bureau when is dealing with the order. The shipping resource gives options for the type of shipping, unit cost of shipping and the region of shipping. For example the shipping resource for this bureau that we created above defines that, there is a Standard shipping available for the region Asia which has a unit cost of 10.25.

Let us try to provide these information to our order ans see how the shipping estimate for the order is calculated. We can update our order by doing a PUT on /order/

Example order request

PUT https://erp.authentise.com/order/00000000-0000-0000-0000-000000order/
Content-Type: application/json

{
    'shipping'  : {
        'name'      : 'Authentise Inc',
        'uri'       : 'https://erp.authentise.com/shipping/00000000-0000-0000-0000-shipping/',
        'address'   : '10002 Wayne st, San Francisco, CA, 92400, USA'
    },
}

Once the order is updated we can see the contents of the order as below:

GET https://erp.authentise.com/order/00000000-0000-0000-0000-000000order/
Content-Type: application/json

{
    'bureau'    : 'https://erp.authentise.com/bureau/00000000-0000-0000-0000-000000bureau/',
    'created'   : "2016-11-02T18:47:58.176307",
    'currency'  : 'USD',
    'estimates' : {
        'print_time'    : 123,
        'cost'          : {
            'amount'    : 6.2454,
            'shipping_amount'   : 10.25,
        },
        'materials': {
            'support'   : 1.5731616,
            'base'      : 50.8655584
        }
    },
    'name'      : 'Authentise Order',
    'model'     : 'https://models.authentise.com/model/00000000-0000-0000-0000-000000model/',
    'materials' : {
        'base'  : 'https://erp.authentise.com/material/00000000-0000-0000-0000-base00material/',
        'suport':' https://erp.authentise.com/material/00000000-0000-0000-0000-supportmaterial/'
    },
    'shipping'  : {
        'name'      : 'Authentise Inc',
        'tracking'  : null,
        'uri'       : 'https://erp.authentise.com/shipping/00000000-0000-0000-0000-shipping/',
        'address'   : '10002 Wayne st, San Francisco, CA, 92400, USA'
    },
    'quantity'  : 3,
    'third_party_provider' : 'https://erp.authentise.com/third-party/00000000-0000-0000-0000-thirdparty/'
    'uri'       : "https://erp.authentise.com/order/00000000-0000-0000-0000-000000order/",
}

In the above order resource we see few changes. The shipping fields have been updated with what we just provided. In addition to that, we have the shipping_amount field in the estimates updated with some value. This value is calculated based on the shipping URI that we provided. The shipping URI had the unit shipping cost multiplier. This cost is multipled to the currency-conversion for the order currency, which is ‘USD’. Hence we have the amount 10.25. If we update the order with a different shipping URI or currency or bureau, the shipping_amount for the order would change accordingly.

You can find full details on how to use the ERP module in Reference