# API: Silobags

---

- [Index](#index)
- [Show](#show)
- [Store](#store)
- [Update](#update)
- [Destroy](#destroy)

<a name="index"></a>
## Index

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|GET|`/silobags`|Default|

### Body
```json
Empty
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>200 - OK</larecipe-badge>
```json
[
    {
        "id": <id>,
        "zona_id": <zona_id>,
        "propriedade_id": <propriedade_id>,
        "empresa_id": <empresa_id>,
        "produto_id": <produto_id>,
        "referencia_id": <referencia_id>,
        "identificacao": <identificacao>,
        "descricao": <descricao>,
        "center_lat": <center_lat>,
        "center_lng": <center_lng>,
        "length": <length>,
        "reta": [
            [
                <lat>,
                <lng>
            ],
            //...
        ],
        "has_alerta": <has_alerta>
    },
    //...
]
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```

<a name="show"></a>
## Show

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|GET|`/silobags`|Default|

### Body
```json
Empty
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>200 - OK</larecipe-badge>
```json
{
    "id": <id>,
    "zona_id": <zona_id>,
    "propriedade_id": <propriedade_id>,
    "empresa_id": <empresa_id>,
    "produto_id": <produto_id>,
    "referencia_id": <referencia_id>,
    "identificacao": <identificacao>,
    "descricao": <descricao>,
    "center_lat": <center_lat>,
    "center_lng": <center_lng>,
    "length": <length>,
    "reta": [
        [
            <lat>,
            <lng>
        ],
        //...
    ],
    "has_alerta": <has_alerta>
}
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```

<a name="store"></a>
## Store

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|POST|`/silobags`|Default|

### Body
```json
{
  "zona_id": int,
  "produto_id": int,
  "identificacao": string,
  "descricao": string,
  "center_lat": double,
  "center_lng": double,
  "length": int,
  "reta": [
    [
      <lat>,
      <lng>
    ],
    //...
  ],
  "referencia_id": int(required when ativos_referencias not present),
  "ativos_referencias": { (required when referencia_id not present)
    "data": [
        {
            "ativo_medicao_id": int,
            "min_val": double,
            "max_val": double
        },
        //...
    ]
  },
  "fatias": [
      {
        "template": string,
        "metro_inicial": int,
        "metro_final": int,
        "secoes": [
            {
                "identificacao": string,
                "observacao": string
            }
        ]
      },
      //...
  ]
}
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>200 - OK</larecipe-badge>
```json
{
    "id": <id>,
    "zona_id": <zona_id>,
    "propriedade_id": <propriedade_id>,
    "empresa_id": <empresa_id>,
    "produto_id": <produto_id>,
    "referencia_id": <referencia_id>,
    "identificacao": <identificacao>,
    "descricao": <descricao>,
    "center_lat": <center_lat>,
    "center_lng": <center_lng>,
    "length": <length>,
    "reta": [
        [
            <lat>,
            <lng>
        ],
        //...
    ],
    "has_alerta": <has_alerta>
}
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```

<a name="update"></a>
## Update

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|PUT|`/silobags/{silobag}`|Default|

### Body
```json
{
  "zona_id": int,
  "produto_id": int,
  "identificacao": string,
  "descricao": string,
  "center_lat": double,
  "center_lng": double,
  "length": int,
  "reta": [
    [
      <lat>,
      <lng>
    ],
    //...
  ],
  "referencia_id": int(required when ativos_referencias not present),
  "ativos_referencias": { (required when referencia_id not present)
    "data": [
        {
            "ativo_medicao_id": int,
            "min_val": double,
            "max_val": double
        },
        //...
    ]
  },
  "fatias": [
      {
        "template": string,
        "metro_inicial": int,
        "metro_final": int,
        "secoes": [
            {
                "identificacao": string,
                "observacao": string
            }
        ]
      },
      //...
  ]
}
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>200 - OK</larecipe-badge>
```json
{
    "id": <id>,
    "zona_id": <zona_id>,
    "propriedade_id": <propriedade_id>,
    "empresa_id": <empresa_id>,
    "produto_id": <produto_id>,
    "referencia_id": <referencia_id>,
    "identificacao": <identificacao>,
    "descricao": <descricao>,
    "center_lat": <center_lat>,
    "center_lng": <center_lng>,
    "length": <length>,
    "reta": [
        [
            <lat>,
            <lng>
        ],
        //...
    ],
    "has_alerta": <has_alerta>
}
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```

<a name="destroy"></a>
## Destroy

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|DELETE|`/silobags/{silobag}`|Default|

### Body
```json
Empty
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>204 - No Content</larecipe-badge>
```json
Empty
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```