# MeshController

## Overview

* [Description](#description)
  * [Mesh Object](#mesh-object)
  * [JSON fields](#json-fields)
  * [CSV fields](#csv-fields)
* [API Reference](#api-reference)
* [GET /](#get-)
* [POST /](#post--json)
* [GET /:id](#get-id)
* [PUT /:id (json)](#put-id-json)
* [GET /:id/data](#get-iddata)
* [GET /data](#get-data)
* [POST / — DEPRECATED](#post---deprecated)

## Description

Path /v2/meshes

Handles all requests regarding mesh: creating, updating, deleting.

### Mesh Object

An example for a mesh JSON object.

```
{ 
 "id":"usm:TVLowboard",
 "visibilityStatus":1,
 "externalIdentifier":"TVLowboard",
 "catalog":"usm",
 "created": "2016-04-11T14:34:14.000Z", 
 "updated": "2016-04-11T14:34:14.000Z", 
 "assetProcesings": [{<list of processings associated with this mesh>>}},
 "links": {"data": "/meshes/usm:TVLowboard/data"}
 }
```

### JSON fields

* id
* visibilityStatus : possible values
  * 0 : SHOWN (visible everywhere)
  * 1 : SHOWN\_IN\_CMS (visible only in cms context)
  * 2 : ARCHIVED (hidden everywhere)
* externalIdentifier
* catalog
* created
* updated
* assetProcessings
* links

### CSV fields

* mesh\_id - externalId of the mesh
* visibilityStatus - possible values
  * 0 : SHOWN (visible everywhere)
  * 1 : SHOWN\_IN\_CMS (visible only in cms context)
  * 2 : ARCHIVED (hidden everywhere)
* asset\_source - http link to mesh source file

## API Reference

### GET /

Generates: application/json

List of all materials matching the filter and visible to the Client

Query Parameters

| Name    | Type    | Comment                                                                      |
| ------- | ------- | ---------------------------------------------------------------------------- |
| catalog | Boolean | If true the textures are included as embedded json objects, default is false |

Response (200 OK): Returns a list of [Mesh Object](#mesh-object).

### POST / (json)

Accepts: application/json Generates: application/json

Creates a new mesh.

Response (201 CREATED): [Mesh Object](#mesh-object)

### GET /:id

Generates: application/json

Returns a specific mesh.

Response(200 OK): [Mesh Object](#mesh-object)

### PUT /:id (json)

Accepts: application/json Generates: application/json

Updates a specific mesh.

Body: [Mesh Object](#mesh-object)

Response (200 OK): updated [Mesh Object](#mesh-object)

### GET /:id/data

Accepts: application/json Generates: application/json

Returns list of meshData for the given mesh id. If no format, all meshdata entries for the given id are returned.

Query Parameters

| Name          | Type    | Comment                                                           |
| ------------- | ------- | ----------------------------------------------------------------- |
| format        | String  | format of requested meshData                                      |
| targetQuality | Integer | quality of requested meshData - default 0 - returns closest match |

Response (200 OK): Returns a list of [MeshData Object](#meshdata-object).

### GET /data

Generates: application/json

List of all meshData matching the filter and visible to the Client

Query Parameters

| Name          | Type            | Comment                                                           |
| ------------- | --------------- | ----------------------------------------------------------------- |
| meshId\[]     | List of strings | filters the result to the given mesh ids                          |
| format        | String          | format of requested meshData                                      |
| targetQuality | Integer         | quality of requested meshData - default 0 - returns closest match |

Response (200 OK): Returns a list of [MeshData Object](#meshdata-object).

### POST / — DEPRECATED

**use** [**POST /meshes**](https://docs.roomle.com/rubens/rest-api/rest-api-reference/catalog#post-idmeshes-multipart) **instead**
