Skip to main content

Backend Api

Enterprise

Overview

All calls are calls to a URL under

https://k3-api.objectcode.de/api/v1.0

The following headers must always be set:

Content-Type: application/json
Accept: application/json
Authorization: Bearer TOKEN

The TOKEN is obtained from the User-Profil.

The language header is optional, but essential for multilanguage data:

X-Language: en

If it is missing, de is assumed. If null is passed for a multilanguage field, this is changed to "". Unfortunately, this is necessary due to the behavior of the framework.

Response statuses

  • 200: Success
  • 201: Resource successfully created
  • 400: Missing data or otherwise invalid request
  • 401: Not authorized
  • 403: Not authorized
  • 405: Not authorized
  • 500: Unknown error

In the event of an error, the following response is usually, but not guaranteed, transmitted:

  • error (boolean): true
  • msg (string): Cause

Available resources

The following resources are available:

  • app: The configurator
  • material: 3D material
  • model 3D model
  • image image for non-3D configurators
  • group: Configuration step
  • variable: Feature
  • value: Characteristic value
  • rule: Rule
  • rule: Rule line
  • article: Article
  • price: Price
  • cfg: Configuration

To obtain the attributes available for each type, you can call up a resource once. The attribute names are self-explanatory:

GET https://k3-api.objectcode.de/api/v1.0/{type}?_limit=1

Calls

Get resource

GET .../{type}/{id}

Returns a resource based on its ID. This also applies if the parents have been deleted.

Parameters

  • type (string): Type of resource
  • id (number): ID of the resource

Result

  • resource (object): The desired resource

Search for resources

GET .../{type}?{query}

Searches for resources based on their attributes. Resources whose parents have been deleted are also returned.

Parameters

  • type (string): Type of resource

  • query (string): Query string a1=v1&a2=v2&a3=v3... Attributes are only searched for AND-linked. The following operators are available:

    • a=1 Attribute a is equal to 1
    • a=!1 Attribute a is not equal to 1
    • a=[1,2] Attribute a is in [1,2]
    • a=![1,2] Attribute a is not in [1,2]
    • a=%1% Attribute a contains 1

    There are the following special attributes in the query:

    • _order (string): in the form attribut:asc|desc specifies a sort order
    • _offset (number): first data record to be delivered
    • _limit (number): Number of data records to be delivered
    • _count (string): If "true", the total number of all hits is delivered in the 'X-Total-Count' header of the response. (Should be used on the first page of a pagination)
    • _select (string): List of attributes to be supplied, comma-separated.

Result

  • resources (array): List of objects found

Create resource

POST .../{type}

Creates a resource

Parameter

  • type (string): Type of resource

Body

  • (object): The resource (without id as an object)

Result

  • (object): The created object incl. id.

Create many resources

POST .../{type}/bulk

Creates resources

Parameters

  • type (string): Type of resource

Body

  • [] (array): The attributes to be changed, not necessarily complete
    • (object): The resource (without id as an object)

Result

List of the created resources, incl. id.

Change resource

PUT .../{type}/{id}

Modifies a resource

Parameter

  • type (string): Type of resource
  • id (number): ID of the resource

Body

  • (string): The attributes to be changed, not necessarily complete

Result

Changed resource

Change many resources

PUT .../{type}

Modifies a resource

Parameter

  • type (string): Type of resource

Body

  • [] (array): The attributes to be changed, not necessarily complete
    • (object): Resource to be changed
      • id (mandatory): ID of the resource to be changed
      • other: The attributes to be changed, not necessarily complete

Result

List of changed resources.

Delete resource

DELETE .../{type}/{id}

Deletes a resource. This is a soft delete. The data record remains in the database, in the "trash".

Parameters

  • type (string): Type of resource
  • id (number): ID of the resource

Result

The deleted object.

Delete many resources

PUT .../{type}/delete

Deletes all transferred resources

Body

  • [] (array): Array with Ids

Result

  • count (number): Number of deleted resources (but all or none are always deleted)