# The manual for the New ION Experience

Check it out! [New ION Experience Manual](https://docs.firstresonance.io/)

For the complete documentation index, see [llms.txt](https://manual.firstresonance.io/llms.txt). This page is also available as [Markdown](https://manual.firstresonance.io/api/examples/parts-and-part-revisioning.md).

## Parts:

Part objects in ION represent abstractions that carry information about a particular part, while the physical parts themselves are [part inventory objects](https://manual.firstresonance.io/api/examples/part-inventory-and-kitting#inventory). The part objects dictate the MBOM, revision, supplier part number, tracking type and other additional attributes about a part.

Below is a list of part attributes and their description. For a more complete list of part fields use the [graphiql](https://app.firstresonance.io/graphiql) editor to view the part object.

### Part Object

| Attribute      | Description                                                                 |
|----------------|-----------------------------------------------------------------------------|
| id             | Unique identifier of Part object                                           |
| partNumber     | parts must have a unique partNumber and revision                           |
| revision       | Revision for part, defaults to A                                          |
| trackingType   | If set enforces all inventory for part to match tracking type. Can be either "serial" or "lot"|
| quantity       | The summed quantity of all inventory for a part                            |
| partsInventory | List of [inventory](https://manual.firstresonance.io/api/examples/part-inventory-and-kitting#inventory) objects related to a part|
| runs           | List of [runs](https://manual.firstresonance.io/features/runs#what-is-a-run) related to part|
| mbom           | List of [MBOM item](https://manual.firstresonance.io/api/examples/mboms#mbom-items) which describe the BOM of a part|

## Query Parts

The queries below specify how to list parts by a filter or get a specific part.

### List

```graphql
query GetParts($filters: PartsInputFilters) {
    parts(filters: $filters) {
        edges {
            node {
                id partNumber description thumbnail { s3Key s3Bucket url }
                fileAttachments { url } quantity
            }
        }
    }
}
```

### Filter Inputs

```json
{
    "filters": {
        "partNumber": {
            "eq": "ion-12"
        }
    }
}
```

### Get

```graphql
query GetPart {
    part(id: 1) {
        id partNumber description quantity
    }
}
```

## Create Part

Creates a part object with a particular part number. Part number and revision must be unique, if no revision is supplied in the create mutation then the part defaults to revision A.

### Mutation

```graphql
mutation CreatePart($input: CreatePartInput!) {
    createPart(input: $input) {
        part {
            id revision partNumber description
        }
    }
}
```

### Inputs

```json
{
    "input": {
        "partNumber": "ion-12",
        "description": "Part for API docs.",
        "revision": "C"
    }
}
```

### Update Part

Updates a part object. Tracking type can only be updated to either "serial" or "lot" if all existing inventory objects related to this part conform to the new tracking type.

### Mutation

```graphql
mutation UpdatePart($input: UpdatePartInput!) {
    updatePart(input: $input) {
        part { id partNumber description revision }
    }
}
```

### Inputs

```json
{
    "input": {
        "id": 1,
        "etag": "etag1",
        "partNumber": "ion-13",
        "description": "Updated part for API docs."
    }
}
```

## Create Part Revision

Creates a new revision for a particular part. A revision can be generated from any part.

### Mutation

```graphql
mutation CreatePartRevision($input: CreatePartRevisionInput!) {
    createPartRevision(input: $input) {
        part {
            id partNumber revision
        }
    }
}
```

### Inputs

```json
{
    "input": {
        "id": 1,
        "etag": "etag1",
        "description": "New revision for part in API docs."
    }
}
```

## Delete Part

Delete a part object. This will delete not only the part object itself but also cascade and delete the MBOM and MBOM substitutes associated with this part.

### Mutation

```graphql
mutation DeletePart($id: ID!, $etag: String!) {
    deletePart(id: $id, etag: $etag) {
        id
    }
}
```

### Inputs

```json
{
    "id": 1,
    "etag": "etag1"
}
```

## Custom Part Revision Scheme

ION allows users to define custom schemes for part revisioning. These schemes are defined within an organization's settings.

### Mutation

```graphql
mutation CreateOrganizationPartRevisionScheme(
        $input: CreatePartRevisionSchemeSettingInput!) {
    createOrganizationPartRevisionScheme(input: $input) {
        organization {
            id settings {
                parts {
                    revisionSchemes {
                        default name allowOverflow format } } }
        }
    }
}
```

### Inputs

```json
{
    "id": 1,
    "name": "new scheme",
    "default": true,
    "format": ["NUMERIC", "NUMERIC", "-", "NUMERIC"],
    "etag": "etag1",
    "allowOverflow": true
}
```

## Update Part Revision Scheme

Once a part revision scheme exists in an organization's settings it can subsequently be updated.

### Mutation

```graphql
mutation UpdateOrganizationPartRevisionScheme(
        $input: UpdatePartRevisionSchemeSettingInput!) {
    updateOrganizationPartRevisionScheme(input: $input) {
        organization {
            id settings {
                parts {
                    revisionSchemes {
                        default name allowOverflow format } } }
        }
    }
}
```

### Inputs

```json
{
    "id": 1,
    "name": "new scheme",
    "default": false,
    "etag": "etag1",
    "allowOverflow": false
}
```

## Converting the Revision Scheme of an Existing Part

There are two strategies for changing the revision scheme of an existing part. Both involve setting the `revisionScheme` for a part in either the `updatePart` or `createPartRevision` mutations above.
