> ## Documentation Index
> Fetch the complete documentation index at: https://developer.worldly.io/llms.txt
> Use this file to discover all available pages before exploring further.

# PM Update Product

## Updating Products

The PM API provides functionality to update products via the API.

See [PM Data Dictionary](/data-dictionary/pm) for details about the parameters.

The API uses the product id to identify the product to update.  The user can then optionally send the following information to update the product.  Only the parameters sent via the update are updated.

Note that the product type and category are *not* editable via the API or manually in the Product Module tool.

The user can update:
• Product name
• Product style/model number
• Bill of Materials--note that updating bill of materials completely overwrites all previously entered bill of materials information.

```json Update theme={null}
{
  "name": "test BoM 201",
  "productType": "Apparel",
  "productCategory": "Dress",
  "modelNumber": "test5"
  "packageMaterials":[{
    "_id": "samplepackage:PK012",
    "part name":"xyz package",
    "amount": 1,
    "measureUnit": "units"
  }],
  "trimMaterials":[{
    "_id": "sampletrim:TR001",
    "amount": 1,
    "measureUnit": "units"
  }],
  "baseMaterials":[{
    "_id": "TX0001",
    "amount": 1,
    "measureUnit": "kilograms"
  }],
  "customMaterials":[{
    "_id": "material:d68657bf-5c3e-472d-a4da-10c8d8e3614b",
    "amount": 1,
    "measureUnit": "kilograms"
  }]
}
```

## Finding products update by user

A common use case is to search for products that have been manually updated by a user in Product Module, in order to pull the updated product impacts into the PLM.

Users can search for "PlatformModifiedBy": "User" to find products updated by users directly in PM.  The "lastEditedAfter": 0 and "lastEditedBefore": 0 search parameters can be used to set the date period to search for edits.

```json Products updated by user theme={null}
{
    "platformModifiedBy": "User",
    "lastEditedAfter": "2021-01-13T16:38:19.386Z",
    "lastEditedBefore": "2021-12-13T20:38:19.386Z"
}
```


## OpenAPI

````yaml api-reference/openapi/product-module-api.json POST /update/{product_id}
openapi: 3.0.0
info:
  title: product-module-api
  version: 1.0.0
servers:
  - url: https://api-v2.production.higg.org/pm-api/v1/product
    description: Production
  - url: https://api-v2.demo.higg.org/pm-api/v1/product
    description: Demo
security:
  - sec0: []
    sec1: []
paths:
  /update/{product_id}:
    post:
      operationId: UpdateProduct
      parameters:
        - in: path
          name: product_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMsiProductApiRequest'
        required: true
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartialMsiProductSearch'
components:
  schemas:
    UpdateMsiProductApiRequest:
      properties:
        name:
          type: string
          nullable: true
        modelNumber:
          type: string
          nullable: true
        baseMaterials:
          items:
            $ref: '#/components/schemas/MaterialMsiProduct'
          type: array
          nullable: true
        customMaterials:
          items:
            $ref: '#/components/schemas/MaterialMsiProduct'
          type: array
          nullable: true
        packageMaterials:
          items:
            $ref: '#/components/schemas/TrimPackageMsiProduct'
          type: array
          nullable: true
        trimMaterials:
          items:
            $ref: '#/components/schemas/TrimPackageMsiProduct'
          type: array
          nullable: true
        certifications:
          items:
            type: string
          type: array
          nullable: true
        barcodes:
          items:
            type: string
          type: array
          nullable: true
      type: object
      additionalProperties: false
    PartialMsiProductSearch:
      properties:
        certifications:
          items:
            $ref: '#/components/schemas/CertificationSearchList'
          type: array
          nullable: true
        productNetWeight:
          type: number
          format: double
          nullable: true
        bomNetWeight:
          type: number
          format: double
          nullable: true
        scores:
          $ref: '#/components/schemas/MsiImpactsApi'
        scoresTotalAltProductCare:
          $ref: '#/components/schemas/MsiImpactsApi'
        billOfMaterialScores:
          $ref: '#/components/schemas/MsiImpactsApi'
        logisticsImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        packagingImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        productCareImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        endOfUseImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        retailImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        dosImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        totalPerUseImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        materials:
          items:
            $ref: '#/components/schemas/PartialMsiProductMaterial'
          type: array
          nullable: true
      required:
        - billOfMaterialScores
        - scores
      type: object
      additionalProperties: false
    MaterialMsiProduct:
      properties:
        _id:
          type: string
        amount:
          type: number
          format: double
        partName:
          type: string
          nullable: true
        measureUnit:
          $ref: '#/components/schemas/MaterialMeasureUnit'
      required:
        - _id
        - amount
        - measureUnit
      type: object
      additionalProperties: false
    TrimPackageMsiProduct:
      properties:
        _id:
          type: string
        partName:
          type: string
          nullable: true
        amount:
          type: number
          format: double
      required:
        - _id
        - amount
      type: object
      additionalProperties: false
    CertificationSearchList:
      properties:
        _id:
          type: string
        assertionAuthorityName:
          type: string
        assertionStandardName:
          type: string
        certificateName:
          type: string
        assertionId:
          type: string
        assertionStandardId:
          type: string
        dateExpires:
          type: number
          format: double
        proofBody:
          type: string
          nullable: true
        dateIssued:
          type: number
          format: double
          nullable: true
        certificationFiles:
          items:
            type: string
          type: array
          nullable: true
      required:
        - _id
        - assertionAuthorityName
        - assertionId
        - assertionStandardId
        - assertionStandardName
        - certificateName
        - dateExpires
      type: object
      additionalProperties: false
    MsiImpactsApi:
      properties: {}
      type: object
      additionalProperties: false
    PartialMsiProductMaterial:
      properties:
        scores:
          $ref: '#/components/schemas/MsiImpactsApi'
        baseScores:
          $ref: '#/components/schemas/MsiImpactsApi'
      required:
        - baseScores
        - scores
      type: object
      additionalProperties: false
    MaterialMeasureUnit:
      enum:
        - kilograms
        - grams
        - milligram
        - pound
        - ounce
      type: string
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: x-api-key
    sec1:
      type: apiKey
      in: header
      name: x-developer-request-token

````