• Authorization

    Token authorization. The header of your request needs to contain:

    Authorization: Token 43j2h5tb8453345

    If we take token as GET-setting (?token=43j2h5tb8453345), his value will overlap the parameter Authorization in HTTP header.

  • Materials

    GET /api/materials/

    Returns the list of materials

    [...
    	{"id": 9,
    	"name": "\u0421.....\u043b",
    	"description": "<p>\u0412.....\u0415!</p>",
    	"price": 73.1,
    	"max_size_x": 310.0,
    	"max_size_y": 240.0,
    	"max_size_z": 190.0,
    	"min_thickness": 0.8},
    ...]
    
  • Models

    GET /api/models/[?material=<MaterialID>[&scale=<scale>]]

    Returns the list of authorized user’s models.

    If material  setting is in the query, the price is calculated.

  • GET /api/models/<ModelID>/[?material=<MaterialID>[&scale=<scale>]]

    Returns model.

    If the model doesn’t belong to the user: 404 NOT FOUND

    If material  setting is in the query, the price is calculated.

  • POST /api/models/

    Upload model to server.

    In case of success it return 201 CREATED, serialized object of the model in the reply body and the object’s corresponding number in the header of the reply Location. file setting may contain file content or download link. The link should be indicated with the protocol and file name.

    Sample of query form:

    <form class="upload-form" method="POST" action="http://localhost:8000/api/models/?token=43j2h5tb8453345" 
    enctype="multipart/form-data">
    	<input name="file" type="input" placeholder="file URL"/>
    	<input name="file" type="file"/>
    	<input name="name" id="id_name" class="i-file-name" type="text">
    	<select class="select-replaced" id="id_category" name="category">
    		<option value="1">Cat 1</option>
    		<option value="2">cat 2</option>
    	</select>
    	<select class="select-replaced" id="id_units" name="units">
    		<option value="mm" selected="selected">Millimeters</option>
    		<option value="sm">Centimeters</option>
    		<option value="m">Meters</option>
    		<option value="inches">Inches</option>
    	</select>
    	<input type="submit" value="submit">
    </form>
    
  • Orders

    Order structure sample:

    {
    	"id": 47,
    	"time": "2014-07-17T09:29:54.875Z",
    	"items_cost": 109,
    	"delivery_cost": 0,
    	"payment_type": 2,
    	"status": 3,
    	"items": [
    		{
    			"model": 1528,
    			"material": 4,
    			"scale": 2.5,
    			"quantity": 1,
    			"cost": 109
    		}
    	]
    }
    
  • GET /api/orders/

    Returns the list of user’s orders

  • GET /api/orders/<OrderID>/

    Returns the user’s order

    If the order doesn’t belong to the user: 404 NOT FOUND

  • POST /api/orders/

    Creating an order.

  • PUT /api/orders/<OrderID>/

    Order updating with full state transition.

    The method tries to get the whole order to the look that was transmitted in the query. So, if in the query items list was transmitted, containing not all(or no elements at all) elements, which are included in the order, elements which are not stated will be deleted from the order, new elements will be added, the existing elements will be different in number. If the mandatory field was not indicated in the order, the error will occur: 400 BAD REQUEST.

    Working with status field.

    Changing status field is forbidden in this query, use methods CANCEL, PAY, PATCH (deprecated).

  • PATCH /api/orders/<OrderID>/

    Order updating with partial state transition.

    The method tries to bring fields of the order close to the data of the query. Thus, if in the query we transmit  items list which contains not all elements of the order, the elements which are not stated will remain unchanged, new elements will be added, the existing elements will be different in number.

    If the mandatory field was not indicated in the order, it will retain its previous value.

    Working with status field.

    DEPRECATED: Left without changes due to presumable problems with HTTP-proxy. Apply methods CANCEL, PAY. To change status field you should create a separate query, which shouldn’t have any information about other fields. Available field values:

    «CANCELED»: refer to method CANCEL

    «PAID»: refer to method PAY

  • CANCEL /api/orders/<OrderID>/

    Cancellation of the order. If the order was remunerated, funds will be returned to the account. It can’t be implemented, if the order is at the production stage.

  • PAY /api/orders/<OrderID>/

    Attempt to pay the order using a private account. In case of not sufficient funds on the account, you will get error 402 PAYMENT REQUIRED.

  • Delivery

  • PATCH /api/orders/<OrderID>/

    Set delivery address for orders with status WAITING_ADDRESS. After the address is successfully saved the order status will change to WAITING_SHIPPING_TYPE or WAITING_PAYMENT.

    The list of transmitted fields depends on the type of delivery.

    For customer pick-up:

    type: 0,
    phone: required field, telephone number
    
    

    For delivery in the RF:

    type: 1,
    phone: required field, telephone number
    street: required field, street
    postcode: required field, zip code
    city_code: required field, city code indicated in the address coding guide
    house: required field, house
    apt: apartment/office
    
    

    For delivery worldwide:

    type: 2,
    phone: required field, telephone number
    street: required field, street
    postcode: required field, zip code
    city: required field, city
    country_code: required field, city code indicated in the address coding guide
    house: required field, house
    apt: apartment/office
    
    

    Example of Request:

    PATCH /api/orders/47/
    {
        "address": {
    		"type": 1,
    		"city_code":1,
    		"phone": "+74722123456",
    		"street": "Green Line str.",
    		"postcode": "308000",
    		"house": 8,
    		"apt": 1
        }
    }
    
  • GET /api/orders/<OrderID>/delivery_options/

    Get tariffs and means of delivery to the address indicated in the order.

    Example of Response:

    [
        {
            "name": "Post of Russia (1st class dispatch-with insurance)",
            "id": 1,
            "price": 519,
            "delivery_time": "",
            "insurance": 1
        },
        {
            "name": "JOP Express (pelican-standard)",
            "id": 5,
            "price": 836,
            "delivery_time": "2-4 дня",
            "insurance": 0
        },
        {
            "name": "PickPoint (postamats and collection points)",
            "id": 29,
            "price": 697,
            "delivery_time": "3-4 дня",
            "insurance": 0
        }
    ]
    
  • POST /api/deliverycalc/

    Delivery calculator. Brings back ways of delivery with price for indicated model and address.

    Unlike calculation of the delivery costs for the order you can indicate only one model.

    Example of Request:

    {
        "postcode": "308000",
        "material": 1,
        "model": 8,
        "city": 1,
        "scale": 1
    }
        

    postcode zip code, For the RF - 6 digits
    material material ID
    model model ID
    city city code indicated in the address coding guide
    country country code indicated in the coding guide
    scale scale, greater than 0

    All fields are required except city and country. In the query you should indicate either city, or country.

  • PATCH /api/orders/<OrderID>/

    Set method of delivery for orders with WAITING_ADDRESS status. For this order you should fix delivery_code characteristic  equal to ID of the chosen delivery means. After successful saving the status of the order will change to WAITING_PAYMENT. To the order information which is brought back will be added the following fields: delivery_cost with the cost of delivery, delivery_name in which the textual name of delivery method is given and delivery_code with the code of delivery.

    Example of Request:

    PATCH /api/orders/47/
    {
        "delivery_code": 1
    }
    Response:
    {
        "id": 47,
        ...
        "status": "WAITING_PAYMENT",
        "delivery_cost": 697,
        "delivery_code": 29,
        "delivery_name": "PickPoint (postamats and collection points)"}
        "items": [...],
        "address": {...},
    }
    
  • Info

  • GET /api/countries/[?name=<name>]

    Return the list of countries for delivery. When entering name setting you will get countries, beginning with name (case insensitive).

  • GET /api/countries/<code>/

    Returns country with code code

  • GET /api/cities/[?name=<name>]

    Returns the list of cities in RF for delivery. When entering name setting you will get cities, beginning with name (case insensitive).

  • GET /api/cities/<code>/

    Returns city with code code