Release notes

  • Currently, PUZZLE adds the parameter "Order.Processor" after the computation has been finished.

    You should not expect that this parameters to remain. This parameter will be removed in a later release without further notification.

Changelog

Component Category Description
Best-Fit Plugin 2.3.1 Dependency PUZZLE core version 49.1.0.
Bug PUZZLE does not add undocumented parameters to a job, with the exception of the parameter "Order.Processor".
Best-Fit Plugin 2.1.0 Bug PUZZLE adds undocumented parameters to the attribute parameters of the JSON representation of a job, after PUZZLE has computed solutions for this job. Resolved: PUZZLE now omit most of them.
Dependency PUZZLE core version 48.0.0.
Best-Fit Plugin 2.0.1 Improvement The Best-Fit Plugin offers its own REST API for clients. The Best-Fit REST API is largely identical to the PUZZLE REST API.
Dependency PUZZLE core version 47.0.0.

Description

This PUZZLE Plugin provides the Best-Fit optimization and a REST-API for the Best-Fit optimization. The Best-Fit REST API is largely identical to the PUZZLE REST API. Therefore, this document describes the differences to the PUZZLE REST API.

1. Best-Fit Optimization

The introduction section describes the core idea of the PUZZLE REST API.

A PUZZLE Best-Fit optimization distributes all order items of a job to the required number of loading devices and finds the appropriate loading devices for the order by means of a Branch and Bound algorithm. PUZZLE can select the appropriate loading devices from the collection of loading devices specified in the loadingDevices attribute of the job.

For a job, PUZZLE creates a collection of solutions, which contains a solution for each required loading device. Those solutions consists of the required loading device together with the positions of the order items packed onto the required loading device. For each order item that fits into at least one loading device, the collection of solutions of a job contains the order item in the quantity specified in the order of the job.

For a Best-Fit optimization, PUZZLE minimizes the number of loading devices required as the main criterion and maximizes the volume utilization of the loads onto the loading devices as the secondary criterion, which is far less important. Currently, a client cannot customize these criteria.

2. Data Objects

The Best-Fit REST API uses the same data objects as the PUZZLE REST API.

Parameters

PUZZLE ignores the parameter Search.SolutionCount for a Best-Fit optimization and always returns exactly one collection of loads for a job.

3. The Job State Machine

The Best-Fit REST API uses the same state machine as the PUZZLE REST API, only with a Best-Fit specific prefix to the urls.

4. Plugins

The Best-Fit REST API supports the same plugins as the PUZZLE REST API.

5. Errors

The Best-Fit REST API has the same errors and error handling as the PUZZLE REST API

6. HTTP Requests

This section describes all available HTTP endpoints of the Best-Fit REST API. For each endpoint, this documentation contains an interactive representation of the structure of the request body schema and the response schema below the endpoint description. In addition, the right column contains request and response samples for these structures.

In order to facilitate understanding, the following scenario is included as example.

For a Best-Fit optimization, PUZZLE will compute a collection of loads required to distribute an order consisting of 5 tablets and 5 usb power supplies. For each load, PUZZLE can select between an off-the-shelf FEFCO 0201 carton and a customized carton in which exactly one tablet fits.

/bestfit

The same behavior as for POST /jobs.

PUZZLE considers considers all loading devices in a job for a Best-Fit optimization.

Request Body schema: application/json
job
required
object

Responses

201

Job is successful created.

Response Headers
Location
string <uri>

The uri of the newly created job.

Response Schema: application/json
jobId
required
integer <int64> >= 1

Identifier created by PUZZLE for a created a job. PUZZLE creates always returns a positive integer.

400

PUZZLE cannot parse the JSON in the request body.

500

An unexpected error (an unhandled exception) occurred in PUZZLE.

post /bestfit
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit

Request samples

application/json
Copy
Expand all Collapse all
{
  • "job":
    {
    }
}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "jobId": 3
}

/bestfit/{jobId}/metadata

The same behavior as for POST /jobs/{jobId}/metadata.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

200

PUZZLE returns the metadata

Response Schema: application/json
jobId
required
integer <int64> >= 1

Identifier created by PUZZLE for a created a job. PUZZLE creates always returns a positive integer.

state
required
string
Enum:"CREATED" "VALID" "SUBMITTED" "DONE" "DELETED"
lastUseTimestamp
required
string

Timestamp of the last access to the job. Format is YYYY-MM-DDTHH:MM:SSZ (according to RFC 3339)

expirationTimestamp
required
string

String containing the time at which PUZZLE automatically deletes this job if the job is not used before the expirationTimestamp. Format is YYYY-MM-DDTHH:MM:SSZ (according to RFC 3339). PUZZLE does not automatically delete a job in state SUBMITTED. If a job has state SUBMITTED, its expirationTimestamp is set to the empty string ("").

timeIntervalUntilExpiration
integer <int64>

Time interval between the current time and the expiration timestamp time in seconds.

orderNumber
required
string

Order number of the job as specified by the client.

errorOccurred
boolean

Flag indicating whether an error occurred during the computation of solutions by PUZZLE (during the transition from state SUBMITTED to DONE). PUZZLE sets the flag to false if no error occurred, otherwise to false.

errorMessage
string

The message of the error occurred during the computation of solutions by PUZZLE If no error occurred, this attribute is set to the empty string.

404

There does not exist a job with the given jobId.

500

An unexpected error (an unhandled exception) occurred in PUZZLE.

get /bestfit/{jobId}/metadata
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}/metadata
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}/metadata

Response samples

application/json
Copy
Expand all Collapse all
{
  • "jobId": 3,
  • "state": "DONE",
  • "lastUseTimestamp": "2019-04-10T14:10:21+0200",
  • "expirationTimestamp": "2019-04-10T19:10:21+0200",
  • "timeIntervalUntilExpiration": 17995,
  • "orderNumber": "order_23129",
  • "errorOccurred": false,
  • "errorMessage": ""
}

/bestfit/{jobId}/validation

The same behavior as for POST /jobs/{jobId}/validation.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

query Parameters
language
string
Example: "en"

The language of the validation messages. A client can specify the language with IETF language tags. If not specified, the system setting language is used.

Currently supported languages are German (de) and English (en).

Responses

201

no error.

Response Schema: application/json
isValid
required
boolean

Flag that indicates if the job is valid. PUZZLE sets the flag to true if a job is valid, otherwise to false.

validationMessages
Array of string

Array of constraints violation messages. If a job is valid, this array is empty.

404

There does not exist a job with the given jobId.

500

An error occurred.

post /bestfit/{jobId}/validation
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}/validation
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}/validation

Response samples

application/json
Copy
Expand all Collapse all
{
  • "isValid": true,
  • "validationMessages": [ ]
}

/bestfit/{jobId}/computation

The same behavior as for POST /jobs/{jobId}/computation.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

201

PUZZLE has successfully accepted the request for Best-Fit computation.

404

There does not exist a job with the given jobId.

500

An error occurred.

post /bestfit/{jobId}/computation
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}/computation
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}/computation

Response samples

application/json
Copy
Expand all Collapse all
{
  • "errorMessage": "PUZZLE cannot find job with id 123",
  • "additionalInformation": "",
  • "errorClass": "de.fraunhofer.iml.puzzle.adapter.execution.Exceptions.Rest.PuzzleJobNotFoundException"
}

/bestfit/{jobId}/computation

The same behavior as for DEL /jobs/{jobId}/computation.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

204

Successfully aborted computation.

404

There does not exist a job with the given jobId.

500

An error occurred.

delete /bestfit/{jobId}/computation
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}/computation
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}/computation

Response samples

application/json
Copy
Expand all Collapse all
{
  • "errorMessage": "PUZZLE cannot find job with id 123",
  • "additionalInformation": "",
  • "errorClass": "de.fraunhofer.iml.puzzle.adapter.execution.Exceptions.Rest.PuzzleJobNotFoundException"
}

/bestfit/{jobId}/summaries

The same behavior as for GET /jobs/{jobId}/summaries.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

200

Successfully created summaries for all solutions of the job.

Response Schema: application/json
Array
solutionId
integer

Unique identifier of the Solution. Generated by PUZZLE. A positive integer.

length
integer >= 0

Length of the bounding box that encloses all positioned order items in millimeters.

width
integer >= 0

Width of the bounding box that encloses all positioned order items in millimeters.

height
integer >= 0

Height of the bounding box that encloses all positioned order items in millimeters.

weight
integer >= 0

Sum of the weight of all positioned order items in grams.

volume
integer <int64> >= 0

Sum of the volume of all positioned order items in cubic millimeters (mm^3).

numberOfPositionedItems
integer >= 0

Number of order items that are placed on the loading device. Not number of distinct order items in the solution.

weightUtilization
integer [ 0 .. 100 ]

The ratio of the sum of weights of positioned order items (equal to the weight field) to the maximum possible weight of the loading device, in percent (integer in range [0,100]).

volumeUtilization
integer [ 0 .. 100 ]

The ratio of the sum of volumes of positioned order items (equal to the volume field) to the maximum possible volume of the loading device, in percent (integer in range [0,100]).

packDensity
integer [ 0 .. 100 ]

The ratio of the sum of volumes of positioned order items (equal to the volume field) to the volume of the bounding box that encloses all positioned order items, in percent (integer in the range [0,100]).

loadingDeviceNumber
string

The number of the loading device used in this solution. If PUZZLE has not assigned a loadingDevice to a solution, this attribute is set to the empty string.

404

There does not exist a job with the given jobId.

500

An error occurred.

get /bestfit/{jobId}/summaries
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}/summaries
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}/summaries

Response samples

application/json
Copy
Expand all Collapse all
[
  • {
    },
  • {
    },
  • {
    }
]

/bestfit/{jobId}/picklists

The same behavior as for GET /jobs/{jobId}/picklists.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

200

Successfully created picklists for all solutions of the job.

Response Schema: application/json
Array
solutionId
integer

Unique identifier of the Solution. Generated by PUZZLE. A positive integer.

loadingDeviceNumber
string

The number of the loading device used in this solution. If PUZZLE has not assigned a loadingDevice to a solution, this attribute is set to the empty string.

picklist
Array of object
404

There does not exist a job with the given jobId.

500

An error in PUZZLE occurred. This includes error messages containing the wrong state of the job.

get /bestfit/{jobId}/picklists
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}/picklists
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}/picklists

Response samples

application/json
Copy
Expand all Collapse all
[
  • {
    },
  • {
    },
  • {
    }
]

/bestfit/{jobId}

The same behavior as for GET /jobs/{jobId}.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

200

Successful creation of the JSON representation of the job

Response Schema: application/json
parameters
required
object

Hash map of the parameters used by PUZZLE. PUZZLE uses default values for each parameter. A client can override any default value by explicitly setting a parameter value. Setting undocumented parameters may result in undefined behavior.

order
required
object

Order that is to be palletized on a pallet or packed in a box.

loadingDevices
required
Array of object

The loading devices on which PUZZLE is to palletize or pack the order.

extension
object

Extension provides a hash map for additional data for the client and PUZZLE. Keys and values must be strings. PUZZLE uses extension itself, so it is highly recommended to use a client specific prefix for extension keys.

solutions
Array of object
404

There does not exist a job with the given jobId.

500

An error in PUZZLE occurred. This includes error messages containing the wrong state of the job.

get /bestfit/{jobId}
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "parameters":
    {
    },
  • "order":
    {
    },
  • "loadingDevices":
    [
    ],
  • "solutions":
    [
    ],
  • "extension":
    {
    }
}

/bestfit/{jobId}

The same behavior as for PUT /jobs/{jobId}.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Request Body schema: application/json
job
required
object

Responses

200

Update was successful

400

PUZZLE cannot parse the JSON in the request body.

404

There does not exist a job with the given jobId.

500

An error in PUZZLE occurred. This includes error messages containing the wrong state of the job.

put /bestfit/{jobId}
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}

Request samples

application/json
Copy
Expand all Collapse all
{
  • "job":
    {
    }
}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "errorMessage": "While parsing the JSON, an error occurred.",
  • "errorClass": "public class com.fasterxml.jackson.databind.exc.InvalidTypeIdException",
  • "additionalInformation": "Missing type id when trying to resolve subtype of [simple type, class de.fraunhofer.iml.puzzle.coreentity.LoadingDevice]: missing type id property 'type' (for POJO property 'loadingDevices') at source: rg.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 1004] (through reference chain: de.fraunhofer.iml.puzzle.specification.jobsAPI.models.CreationTask["job"] .fraunhofer.iml.puzzle.coreentity.EntityJob["loadingDevices"]->java.util.ArrayList[0])"
}

/bestfit/{jobId}

The same behavior as for DEL /jobs/{jobId}.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

205

PUZZLE has successfully deleted the job.

404

There does not exist a job with the given jobId.

500

An error in PUZZLE occurred. This includes error messages containing the wrong state of the job.

delete /bestfit/{jobId}
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "errorMessage": "PUZZLE cannot find job with id 123",
  • "additionalInformation": "",
  • "errorClass": "de.fraunhofer.iml.puzzle.adapter.execution.Exceptions.Rest.PuzzleJobNotFoundException"
}

/bestfit/{jobId}/prolong

The same behavior as for GET /jobs/{jobId}/prolong.

path Parameters
jobId
required
integer <int64> >= 1

The Id of the job.

Responses

200

Prolongation was successful

404

There does not exist a job with the given jobId.

500

An error in PUZZLE occurred. This includes error messages containing the wrong state of the job.

put /bestfit/{jobId}/prolong
PUZZLE instance at host hostname port 8888
http://hostname:8888/puzzle/api/v1/bestfit/{jobId}/prolong
PUZZLE instance at localhost port 8888
http://localhost:8888/puzzle/api/v1/bestfit/{jobId}/prolong

Response samples

application/json
Copy
Expand all Collapse all
{
  • "errorMessage": "PUZZLE cannot find job with id 123",
  • "additionalInformation": "",
  • "errorClass": "de.fraunhofer.iml.puzzle.adapter.execution.Exceptions.Rest.PuzzleJobNotFoundException"
}