# Unidades de Medida

### Criar Unidade de Medida

{% openapi src="<https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7>" path="/api/units\_of\_measure" method="post" %}
[TOConline Open API.yaml](https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media\&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7)
{% endopenapi %}

{% tabs %}
{% tab title="Payload" %}
{% code title="Payload" %}

```json
{
    "data": {
        "type": "units_of_measure",
        "attributes": {
            "unit_of_measure": "Anos de Luz",
            "is_default": false
        }
    }
}

```

{% endcode %}
{% endtab %}

{% tab title="Response" %}
{% code title="Response" %}

```json
{
    "data": {
        "type": "units_of_measure",
        "id": "9",
        "attributes": {
            "unit_of_measure": "Anos de Luz",
            "is_default": false
        },
        "relationships": {
            "company": {
                "data": {
                    "type": "current_company",
                    "id": "800000046"
                }
            }
        }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

###

### Obter Todas  as Unidade de Medida

{% openapi src="<https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7>" path="/api/units\_of\_measure" method="get" %}
[TOConline Open API.yaml](https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media\&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7)
{% endopenapi %}

{% code title="GET" %}

```
https://api/v1.toconline.com/api/units_of_measure
```

{% endcode %}

<details>

<summary>Exemplo de Response </summary>

```json
{
    "data": [
        {
            "type": "units_of_measure",
            "id": "6",
            "attributes": {
                "unit_of_measure": "horas",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "5",
            "attributes": {
                "unit_of_measure": "Kg",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "4",
            "attributes": {
                "unit_of_measure": "Lt",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "3",
            "attributes": {
                "unit_of_measure": "m",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "2",
            "attributes": {
                "unit_of_measure": "un",
                "is_default": true
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "9",
            "attributes": {
                "unit_of_measure": "Anos de Luz",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        }
    ]
}
```

</details>

###

### Remover Unidades de Medida

{% openapi src="<https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7>" path="/api/units\_of\_measure/{unitsOfMeasureId}" method="delete" %}
[TOConline Open API.yaml](https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media\&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7)
{% endopenapi %}

{% code title="DELETE" %}

```
https://api/v1.toconline.com/api/units_of_measure/{id}
```

{% endcode %}

<details>

<summary>Exemplo de Response</summary>

```json
{
    "meta": {}
}
```

</details>
