> ## 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.

# MSI Update Materials

## Updating Custom Materials

The MSI API provides functionality to update custom materials via the API.  Note it is not currently possible to update custom trims or packaging via that API.  The API returns the material Higg ID and impacts in the response.

See [MSI Data Dictionary](/data-dictionary/msi#materialtrimpackage-metadata) for details about the parameters.

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

The user can update:
• material name
• material code
• custom material category
• base material, % composition for blends, and raw material process stage
• yield

<Warning>
  Note that updating any of base material, % composition for blends, raw material process stage and yield completely overwrites the previously entered base materials. For example, if the original material was 80% organic cotton/20% polyester, then sending 100% cotton fiber will change the material to 100% cotton fiber.
</Warning>

```json Updating material theme={null}
{
    "name": "Test blend",
    "code": "xyz PLM code",
    "baseMaterials":[{
        "baseMaterialId": "FM002",
        "processId": "PR0804000648",
        "blendPercentage": 60
    }, {
        "baseMaterialId": "FM005",
        "blendPercentage": 40
    }],
    "yieldInfo": [
        {
            "type": "Yards (volumetric)",
            "width": 1,
            "widthUnit": "m",
            "thickness": 2,
            "thicknessUnit": "in",
            "densityVolumetric": 13,
            "densityVolumetricUnit": "kg/m3"
        }
    ],
    "category": "TX"
}
```

## Finding materials modified by user

A common use case is to search for materials that have been manually updated by a user in MSI, in order to pull the updated material impacts into the PLM.

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

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


## OpenAPI

````yaml api-reference/openapi/msi-api.json POST /materials/update-limited-lcia/{materialId}
openapi: 3.0.0
info:
  title: msi-api
  version: 1.0.0
servers:
  - url: https://api-v2.production.higg.org/msi-api/v1
    description: Production
  - url: https://api-v2.demo.higg.org/msi-api/v1
    description: Demo
security:
  - sec0: []
    sec1: []
paths:
  /materials/update-limited-lcia/{materialId}:
    post:
      operationId: UpdateMaterialLimitedLcia
      parameters:
        - in: path
          name: materialId
          required: true
          schema:
            type: string
      requestBody:
        $ref: '#/components/requestBodies/UpdateMaterialApi'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MaterialEntityWithoutProcessLimited'
components:
  requestBodies:
    UpdateMaterialApi:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdateMaterialApi'
      required: true
  schemas:
    MaterialEntityWithoutProcessLimited:
      properties:
        version:
          $ref: '#/components/schemas/MaterialVersionWithoutProcessLimited'
        history:
          items:
            $ref: '#/components/schemas/MaterialVersionWithoutProcessLimited'
          type: array
          nullable: true
      required:
        - version
      type: object
      additionalProperties: false
    UpdateMaterialApi:
      properties:
        name:
          type: string
          nullable: true
        code:
          type: string
          nullable: true
        yieldInfo:
          items:
            $ref: '#/components/schemas/YieldInfo'
          type: array
          nullable: true
        baseMaterials:
          items:
            $ref: '#/components/schemas/BaseMaterialProcessId'
          type: array
          nullable: true
        category:
          type: string
          nullable: true
      type: object
      additionalProperties: false
    MaterialVersionWithoutProcessLimited:
      properties:
        baseMaterials:
          items:
            $ref: '#/components/schemas/BaseMaterialEntityOptionalProcessLimited'
          type: array
      required:
        - baseMaterials
      type: object
      additionalProperties: false
    YieldInfo:
      properties:
        type:
          $ref: '#/components/schemas/YieldType'
        width:
          type: number
          format: double
          nullable: true
        widthUnit:
          $ref: '#/components/schemas/YieldWidth'
        thickness:
          type: number
          format: double
          nullable: true
        thicknessUnit:
          $ref: '#/components/schemas/YieldThickness'
        densityLinear:
          type: number
          format: double
          nullable: true
        densityLinearUnit:
          $ref: '#/components/schemas/YieldDensityLinear'
        densityVolumetric:
          type: number
          format: double
          nullable: true
        densityVolumetricUnit:
          $ref: '#/components/schemas/YieldDensityVolumetric'
      required:
        - type
      type: object
      additionalProperties: false
    BaseMaterialProcessId:
      properties:
        blendPercentage:
          type: number
          format: double
          nullable: true
        baseMaterialId:
          type: string
        processes:
          properties: {}
          additionalProperties:
            type: string
          type: object
          nullable: true
      required:
        - baseMaterialId
      type: object
      additionalProperties: false
    BaseMaterialEntityOptionalProcessLimited:
      properties:
        cycles:
          $ref: '#/components/schemas/MaterialCyclesLimited'
      type: object
      additionalProperties: false
    YieldType:
      enum:
        - Yards (linear)
        - Meters (linear)
        - Feet (linear)
        - Square Yards (linear)
        - Square Meters (linear)
        - Square Feet (linear)
        - Yards (volumetric)
        - Meters (volumetric)
        - Feet (volumetric)
        - Square Yards (volumetric)
        - Square Meters (volumetric)
        - Square Feet (volumetric)
      type: string
    YieldWidth:
      enum:
        - m
        - yd
        - in
        - cm
      type: string
    YieldThickness:
      enum:
        - in
        - cm
        - mm
      type: string
    YieldDensityLinear:
      enum:
        - g/m2
        - kg/m2
        - lb/yd2
        - oz/yd2
      type: string
    YieldDensityVolumetric:
      enum:
        - kg/m3
        - lb/ft3
      type: string
    MaterialCyclesLimited:
      properties: {}
      type: object
      additionalProperties:
        $ref: '#/components/schemas/MaterialCycleResultLimited'
    MaterialCycleResultLimited:
      properties:
        selected:
          items:
            $ref: '#/components/schemas/MaterialSelectedProcessLimited'
          type: array
        scores:
          $ref: '#/components/schemas/MsiImpactScoresLimited'
        detailProcesses:
          items:
            $ref: '#/components/schemas/DetailProcesses'
          type: array
          nullable: true
        stageName:
          type: string
          nullable: true
      required:
        - scores
        - selected
      type: object
      additionalProperties: false
    MaterialSelectedProcessLimited:
      properties:
        scores:
          $ref: '#/components/schemas/MsiImpactScoresLimited'
      required:
        - scores
      type: object
      additionalProperties: false
    MsiImpactScoresLimited:
      properties:
        impact:
          type: number
          format: double
        globalWarmingPct:
          type: number
          format: double
        eutrophicationPct:
          type: number
          format: double
        waterScarcityPct:
          type: number
          format: double
        abioticDepletionPct:
          type: number
          format: double
        chemistryPct:
          type: number
          format: double
        waterConsumptionPct:
          type: number
          format: double
        biogenicCarbonPct:
          type: number
          format: double
        globalWarmingPts:
          type: number
          format: double
        eutrophicationPts:
          type: number
          format: double
        waterScarcityPts:
          type: number
          format: double
        abioticDepletionPts:
          type: number
          format: double
        chemistryPts:
          type: number
          format: double
      required:
        - abioticDepletionPct
        - abioticDepletionPts
        - biogenicCarbonPct
        - chemistryPct
        - chemistryPts
        - eutrophicationPct
        - eutrophicationPts
        - globalWarmingPct
        - globalWarmingPts
        - impact
        - waterConsumptionPct
        - waterScarcityPct
        - waterScarcityPts
      type: object
      additionalProperties: false
    DetailProcesses:
      properties:
        name:
          type: string
        id:
          type: string
      required:
        - id
        - name
      type: object
      additionalProperties: false
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: x-api-key
    sec1:
      type: apiKey
      in: header
      name: x-developer-request-token

````