Skip to main content

Part images

Images are identified by an image_id. These IDs must be unique within a catalog.

In Partium, images are used for two tasks. Images can be used as reference images to enhance the Partium image search and can be displayed in the UI to describe part types. Each image belongs to exactly one part type but part types can contain multiple images.

Reference images are used by the Partium system to identify part types. Multiple images can be added to a part type to enhance the image search.

See What kind of part pictures can be used as reference images

Display images are displayed with the corresponding part in the user interface. Multiple images can be added to a part type.

The purpose of an image is defined by the info field in the image description. The info field contains a list of tokens that the system can use to determine for what the image is used for. The exact meaning of the field depends on the individual catalog configuration but usually the following standard configuration is used:

Info-ValueDescription
searchableImage is a reference used for searching
displayImage is displayed in the UI
searchable displayBoth
display weight=3Display image with priority weight (recommended)
display position=3Display image with priority position (deprecated, backwards compatibility only)

Order of display imagesโ€‹

The order of display images can be controlled using two complementary mechanisms:

Explicit position fieldโ€‹

Display images can be explicitly ordered using the position field in the image definition:

  • position is an integer value starting from 1
  • Only positive integers are allowed (1, 2, 3, ...)
  • Images with explicit positions are always displayed first, sorted by their position values
  • If multiple images have the same position value, they are sorted alphabetically by image_id
  • The position field can only be set for images that include the display token in their info field

Permission Requirements:

  • Only users with dataContributor or dataValidator roles can set or modify the position field
  • Other roles (including catalogAdmin) cannot specify positions and will receive an authorization error

Priority ordering via catalog configurationโ€‹

Display image order can also be influenced by adding priority tokens to the info field, which work with the catalog configuration:

Syntax Update

The recommended syntax is now weight=x for better semantic clarity. The previous position=x syntax is deprecated and kept only for backwards compatibility.

Example: info="display weight=3"

Available syntax:

  • Recommended: weight=x (where x is a number) - Example: info="display weight=3"
    • Use this syntax for all new implementations for better semantic clarity
  • Deprecated: position=x syntax is deprecated and kept only for backwards compatibility - Example: info="display position=3"
    • This syntax still works but should be migrated to weight=x
    • Only use this if updating legacy code that cannot be immediately migrated
  • If both weight=x and position=x are present, weight=x takes precedence

How it works:

  • Priority tokens are processed according to the catalog's image configuration rules
  • These work alongside the explicit position field to determine final display order
  • The exact behavior depends on the catalog's configuration settings
  • This method provides flexible ordering based on metadata patterns and business rules
note

There is a maximum number of images displayed in the UI. In the standard catalog configuration, the maximum is 5. If more than the maximum number of display images are defined for a part, the system selects images to be displayed with the following priority:

  1. Explicitly positioned images (using the position field) are always prioritized and displayed first

    • If there are more positioned images than the maximum, only the first ones (lowest position values) are shown
  2. Images with catalog-configured priorities (using info field tokens like weight=x or deprecated position=x) fill remaining slots:

    • These are processed according to the catalog's image configuration rules
    • Images with higher priority values may be discarded first (depending on catalog configuration)
    • For images with the same priority value, the system tries to maintain evenly spaced gaps
  3. Non-positioned images fill any remaining slots, sorted by the catalog's default ordering rules

Creating or updating part imagesโ€‹

POST /1/catalog/images

Multiple images can be created and/or updated in one call by specifying a list of definitions in images and a list of image files. The endpoint returns a list of ids of images, which have been created and a list of updated ids. The result contains also an error dictionary in case some images could not be created with corresponding error descriptions.

note

Unlike other upsert operations, this endpoint expects a request of type multipart/form-data because the image file data is attached to the search request payload.

note

This endpoint will respond with error code 503 when the catalog API is in maintenance mode.

ParameterValue
imagesList of image definitions
filesList of image file parts

images contains a list of image definitions. Each image definition must contain the following fields:

ParameterValueRequired
image_idUnique id of the image in the catalogYes
part_idId of the part type to which this image belongsYes
infoMeta data information to define the purpose of this imageYes
positionDisplay order position (1, 2, 3...) for display images onlyNo
Permission Required

The position field can only be set by users with dataContributor or dataValidator roles. Other roles will receive an authorization error if they attempt to set this field.

๐Ÿกข See API Reference


> POST https://api.partium.io/1/catalog/images
> Authorization: Bearer <<Your Access Token or API Key>>
> Content-Type: multipart/form-data; boundary=549844d5-2a2e-4006-8ba9-6ca3423e3fa0
>
> --549844d5-2a2e-4006-8ba9-6ca3423e3fa0
> Content-Disposition: form-data; name="images"
> Content-Type: application/json
>
> [
> {
> "image_id": "image1",
> "part_id": "part1",
> "info": "searchable display"
> },
> {
> "image_id": "image2",
> "part_id": "part1",
> "info": "display"
> }
> ]
> --549844d5-2a2e-4006-8ba9-6ca3423e3fa0
> Content-Disposition: form-data; name="files"; filename="image1.jpg"
> Content-Type: image/jpeg
>
> <<your image binary content 1>>
> --549844d5-2a2e-4006-8ba9-6ca3423e3fa0
> Content-Disposition: form-data; name="files"; filename="image2.jpg"
> Content-Type: image/jpeg
>
> <<your image binary content 2>>
> --549844d5-2a2e-4006-8ba9-6ca3423e3fa0--
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< {
< "created": ["image1", "image2"],
< "updated": [],
< "errors": {}
< }
note

Replace <<Your Access Token or API Key>> with the preferred authentication method. See Authentication.

Position Authorization Example

If a user without proper permissions tries to set a position, the API will respond with an error:

{
"created": [],
"updated": [],
"errors": {
"image1": ["image 'image1' only authorized roles can set position"]
}
}

Deleting part imagesโ€‹

DELETE /1/catalog/images

Multiple images can be deleted in one call by specifying a list of image ids. The endpoint returns a list of ids of images, which have been deleted. The result contains also an error dictionary in case some images could not be deleted with corresponding error descriptions.

note

This endpoint will respond with error code 503 when the catalog API is in maintenance mode.

๐Ÿกข See API Reference


> DELETE https://api.partium.io/1/catalog/images
> Authorization: Bearer <<Your Access Token or API Key>>
> Content-Type: application/json
>
> ["image1"]
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< {
< "deleted": ["image1"],
< "errors": {}
< }
note

Replace <<Your Access Token or API Key>> with the preferred authentication method. See Authentication.


Listing part imagesโ€‹

POST /1/catalog/images/list

Query a list of image descriptions. The list can be filtered by specifying a list of part_ids. A paging mechanism can be used to fetch more data if the number of results exceeds the paging limit.

ParameterValue
query.part_idsOptional list of part_ids to which the images belong
paging.limitMaximum number of results returned by the endpoint
paging.last_object_idUse this id to get the next page of results. The id is returned by a previous call to this endpoint
projectionOptional list of fields to be included in the response. Possible values: part_id, info, position

๐Ÿกข See API Reference


> POST https://api.partium.io/1/catalog/parts/list
> Authorization: Bearer <<Your Access Token or API Key>>
> Content-Type: application/json
>
>{
> "paging": {
> "limit": 10
> },
> "projection": ["part_id", "info"]
>}
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< {
< "result": [
< {
< "image_id": "image1",
< "part_id": "part1",
< "info": "searchable display"
< },
< {
< "image_id": "image2",
< "part_id": "part1",
< "info": "display"
< }
< ],
< "last_object_id": "unique_object_id",
< "more_data": false
< }
note

Replace <<Your Access Token or API Key>> with the preferred authentication method. See Authentication.

more_data in the response is true indicates that there are more results to fetch. In that case use the returned last_object_id as a parameter for the next call to fetch the next page of results. Repeat this until more_data is false.


Fetching image descriptions by IDโ€‹

POST /1/catalog/images/select

Fetch a list of image descriptions by specifying a list of image ids.

ParameterValue
image_idsList of ids of images to fetch
projectionOptional list of fields to be included in the response. Possible values: part_id, info, position

๐Ÿกข See API Reference


> POST https://api.partium.io/1/catalog/images/select
> Authorization: Bearer <<Your Access Token or API Key>>
> Content-Type: application/json
>
>{
> "image_ids": ["image1", "image2"],
> "projection": ["part_id", "info"]
>}
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< [
< {
< "image_id": "image1",
< "part_id": "part1",
< "info": "searchable display"
< },
< {
< "image_id": "image2",
< "part_id": "part1",
< "info": "display"
< }
< ]
note

Replace <<Your Access Token or API Key>> with the preferred authentication method. See Authentication.


Getting one image descriptionโ€‹

POST /1/catalog/images/{image_id}

Get the description of one image by specifying an image_id.

ParameterValue
image_idUnique ID of an image to fetch

๐Ÿกข See API Reference


> GET https://api.partium.io/1/catalog/image/image1
> Authorization: Bearer <<Your Access Token or API Key>>
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< {
< "image_id": "image1",
< "part_id": "part1",
< "info": "searchable display"
< }
note

Replace <<Your Access Token or API Key>> with the preferred authentication method. See Authentication.


Getting one image fileโ€‹

POST /1/catalog/images/{image_id}/original

Get the original image file that was uploaded of one image by specifying an image_id.

ParameterValue
image_idUnique ID of an image to fetch

๐Ÿกข See API Reference


> GET https://api.partium.io/1/catalog/image/image1/original
> Authorization: Bearer <<Your Access Token or API Key>>
>
< HTTP/1.1 200 OK
< Content-Type: image/jpeg
<
< <<binary_image_data>>
note

Replace image1 in the example above with the actual ID of the image file to be queried.

Replace <<Your Access Token or API Key>> with the preferred authentication method. See Authentication.