NextGen APIs

POST /integration/inventory/r1/materials

Http Verb

POST

Url

/integration/inventory/r1/materials

Permissions required

Material: Edit (fsm.core.material.edit)

Last Modified Version

r1

Tech Tags


Available Async

No

BPMN Diagram

diagram (29).svg

Business Logic

This Integration API creates or updates material’s registry.

System verifies Permission Required and starts the elaboration that is organized in steps.

STEP 1 - External System Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: External Systems

Input: externalSystemCode, active=true

Output: externalSystemId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 2 - Measurement Unit Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: Measurement Units

Input: measurementUnitCode, active=true

Output: measureUnitId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 3 - Material Type Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: Material Types

Input: typeCode

Output: typeId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 4 - Material Management Type Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: Material Management Types

Input: managementTypeCode

Output: managementTypeId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 5 - Material Class Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: Material Classes

Input: classCode, active=true

Output: classId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 6 - Material Item Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: Material Items

Input: itemCode, active=true

Output: itemId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 7 - Goods Group Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: Goods Groups

Input: goodsGroupCode, active=true

Output: goodsGroupId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 8 - Meter Brand Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: Meter Brands

Input: meterBrandCode, active=true

Output: meterBrandId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 9 - Material Existence

System takes Input fields and checks their existence.

API Verb: GET

Resource: Materials

Input: code

Output: materialId

If System can obtain the Output fields → Update → continue to step Material Update.

If System can’t obtain the Output fields → Creation → continue to next step.

Error Type:

  • Others - see link in Resource

STEP 10 - Material Creation

System takes Input fields and creates the entity.

API Verb: POST

Resource: Material

Input: code, description, measureUnitId, validityBegin, validityEnd, typeId, managementTypeId, classId, itemId, goodsGroupId, meterBrandId, alternativeCode, extendedDescription, externalStatus, note, externalSystemId, generic, managedInStock, active

Output: Response State, materialId (only for SUCCESS)

If Response State is SUCCESS → elaboration is stopped. See Response payload fields.

If Response State is ERROR → elaboration is stopped. See Response payload fields.

Error Type:

  • Others - see link in Resource

STEP 11 - Material Update

System takes Input fields and updates the entity.

This step is skipped if Input fields are absent.

API Verb: PATCH

Resource: Material

Input: materialId, description, measureUnitId, validityBegin, validityEnd, typeId, managementTypeId, classId, itemId, goodsGroupId, meterBrandId, alternativeCode, extendedDescription, externalStatus, note, externalSystemId, generic, managedInStock, active

Output: Response State

If Response State is SUCCESS → elaboration is stopped. See Response payload fields.

If Response State is ERROR → elaboration is stopped. See Response payload fields.

Error Type:

  • Others - see link in Resource

Path Parameters

As their name suggests, they are included in the URL path of the endpoint.

Not applicable.

Query String Parameters

Start with a ? and includes parameters listed one after the another separated by &.

Not applicable.

Header Parameters

Parameters included in the request headers. Generally, request headers are used to keep authorization parameters.

Default.

Request Body Parameters


Request body parameters are used when clients send data to the API. They are shipped in a JSON Object only in POST, PUT, or PATCH requests.

Field

Description

Mandatory

Constraint

1

code

Material Code

Y

Not Blank

2

externalSystemCode

External System Code

Y

Not Blank

3

description

Material Description

(Mandatory in case of creation)

N

Absent or Not Null


4

measurementUnitCode

Measurement Unit Code

(Mandatory in case of creation)

N

Absent or Not Blank

5

validityBegin

Validity Begin

N


6

validityEnd

Validity End

N


7

typeCode

Material Type Code

(Mandatory in case of creation)

N

Absent or Not Blank

8

managementTypeCode

Material Management Type Code

(Mandatory in case of creation)

N

Absent or Not Blank


9

classCode

Material Class Code

N

Absent or Null or Not Blank

10

itemCode

Material Item Code

N

Absent or Null or Not Blank

11

goodsGroupCode

Goods Group Code

N

Absent or Null or Not Blank

12

meterBrandCode

Meter Brand Code

N

Absent or Null or Not Blank

13

alternativeCode

Alternative Code (ex: Code 2)

N


14

extendedDescription

Extended Description (ex: Extended Description 2)

N


15

externalStatus

External Status

N


16

note

Note

N


17

generic

Flag “Generic”

N


18

managedInStock

Flag “Managed In Stock”

N


19

active

Enable/disable data

N

Default true

The objects in input could have also the extension object that allows to add additional, customized data to this API. More info here How to use APIs: Custom data via Extension.

Request example

Creation example

JSON
{
    "extension": {},
    "code": "materialIdentifier",
    "externalSystemCode": "SAP",
    "description": [
        {
            "lang": "en",
            "value": "DESCRIPTION"
        }
    ],
    "measurementUnitCode": "KG",
    "validityBegin": "2024-08-22T09:51:10.477Z",
    "validityEnd": "2024-08-22T09:51:10.477Z",
    "typeCode": "INTERNAL",
    "managementTypeCode": "CON",
    "classCode": "GEN",
    "itemCode": "BS",
    "goodsGroupCode": "TEST",
    "meterBrandCode": "WB",
    "alternativeCode": "string",
    "extendedDescription": [
        {
            "lang": "en",
            "value": "EXTENDED DESCRIPTION"
        }
    ],
    "generic": false,
    "managedInStock": true
}

 

Update example

{
    "extension": {},
    "code": "materialIdentifier",
    "externalSystemCode": "SAP",
    "alternativeCode": "CODE_alternative",
    "description": [
        {
            "lang": "en",
            "value": "DESCRIPTION"
        }
    ],
    "extendedDescription": [
        {
            "lang": "en",
            "value": "EXTENDED_DESCRIPTION"
        }
    ],
    "note": [
        {
            "lang": "en",
            "value": "NOTE"
        }
    ]
}


Response documentation

Response payload fields

Compliant with RFC Standard https://www.rfc-editor.org/rfc/rfc9457.html

Extension fields:

Field

Description

Note

id

Id of the created item

Only for SUCCESS in CREATE case

code

Extension member of a Problem Details Object that contains the error code

Only for ERROR

Response example

JSON
{
  "type": "about:blank",
  "title": "Not Found",
  "status": 404,
  "detail": "External system string does not exist",
  "instance": "/integration/inventory/r1/materials",
  "code": "IA001_001"
}

 Response error codes