Skip to content

API Routes

Emily Parkes edited this page Jul 3, 2023 · 12 revisions

Clay

Creations

Glazes

Shapes

Statuses


Clay

GET /api/v1/clay

Returns

```json
[
{
"id": 1,
"clay": "White",
"in_use": 1
},
{
"id": 2,
"clay": "Grey Pebble",
"in_use": 1
},
{
"id": 3,
"clay": "Primo Red Stoneware",
"in_use": 1
}
]
```

GET /api/v1/clay/:id

POST /api/v1/clay

Send

```json
{
"clay": "Blue Pebble"
}
```

Returns

```json
{
"id": 6,
"clay": "Blue Pebble"
}
```

PATCH /api/v1/clay

DELETE /api/v1/clay/:id

Creations

GET /api/v1/creations

returns

[
	{
		"id": 1,
		"clayId": 1,
		"clay": "White",
		"shapeId": 5,
		"shape": "Vase",
		"statusId": 2,
		"status": "Leather Hard",
		"weightLeatherHard": 0,
		"weightBoneDry": 0,
		"weightBisqueFired": 0,
		"weightGlazed": 0,
		"weightComplete": 0,
		"dateCreated": "2020-06-15T13:45:30",
		"dateComplete": "2020-07-15T13:45:30",
		"description": "Creations by emily is great",
		"note": "Glaze with criss-cross pattern",
		"name": "Le Vase",
		"imgLeatherHard": null,
		"imgBisqueFired": null,
		"imgGlazed": null,
		"imgComplete": "/images/vase.png",
		"imgGallery": null,
		"glazes": [
			{
				"id": 1,
				"glaze": "Clear"
			},
			{
				"id": 10,
				"glaze": "White"
			},
			{
				"id": 11,
				"glaze": "Peach"
			}
		]
	},
	{
		"id": 2,
		"clayId": 2,
		"clay": "Grey Pebble",
		"shapeId": 2,
		"shape": "Plate",
		"statusId": 1,
		"status": "Wet",
		"weightLeatherHard": 0,
		"weightBoneDry": 0,
		"weightBisqueFired": 0,
		"weightGlazed": 0,
		"weightComplete": 0,
		"dateCreated": "2020-05-24T14:45:30",
		"dateComplete": "2020-06-24T14:45:30",
		"description": "",
		"note": "Glaze with criss-cross pattern",
		"name": "Le Plate",
		"imgLeatherHard": null,
		"imgBisqueFired": null,
		"imgGlazed": null,
		"imgComplete": "",
		"imgGallery": null,
		"glazes": [
			{
				"id": 1,
				"glaze": "Clear"
			},
			{
				"id": 10,
				"glaze": "White"
			}
		]
	},
...]

GET /api/v1/creations/2

returns

{
	"id": 2,
	"clayId": 2,
	"clay": "Grey Pebble",
	"shapeId": 2,
	"shape": "Plate",
	"statusId": 1,
	"status": "Wet",
	"weightLeatherHard": 0,
	"weightBoneDry": 0,
	"weightBisqueFired": 0,
	"weightGlazed": 0,
	"weightComplete": 0,
	"dateCreated": "2020-05-24T14:45:30",
	"dateComplete": "2020-06-24T14:45:30",
	"description": "",
	"note": "Glaze with criss-cross pattern",
	"name": "Le Plate",
	"imgLeatherHard": null,
	"imgBisqueFired": null,
	"imgGlazed": null,
	"imgComplete": "",
	"imgGallery": null,
	"glazes": [
		{
			"id": 1,
			"glaze": "Clear"
		},
		{
			"id": 10,
			"glaze": "White"
		}
	]
}

POST /api/v1/creations/new-creation

sends

{
	"clayId": 1,
	"glazes": [{"id": 1, "glaze": "Clear"}],
	"name": "Espresso mini",
	"note": "hi",
	"shapeId": 1,
 	"statusId": 1,
	"weight": "123"
}

returns

{
	"id": 12,
	"clayId": 1,
	"clay": "White",
	"shapeId": 1,
	"shape": "Coffee Cup",
	"statusId": 1,
	"status": "Wet",
	"weightLeatherHard": null,
	"weightBoneDry": null,
	"weightBisqueFired": null,
	"weightGlazed": null,
	"weightComplete": null,
	"dateCreated": null,
	"dateComplete": null,
	"description": null,
	"note": "hi",
	"name": "Espresso mini",
	"imgLeatherHard": null,
	"imgBisqueFired": null,
	"imgGlazed": null,
	"imgComplete": null,
	"imgGallery": null,
	"glazes": [
		{
			"id": 1,
			"glaze": "Clear"
		}
	]
}

PATCH /api/v1/creations/update-creation/2

sends

{
	"id": 12,
	"clayId": 1,
	"clay": "White",
	"shapeId": 1,
	"shape": "Coffee Cup",
	"statusId": 1,
	"status": "Wet",
	"weightLeatherHard": null,
	"weightBoneDry": null,
	"weightBisqueFired": null,
	"weightGlazed": null,
	"weightComplete": null,
	"dateCreated": null,
	"dateComplete": null,
	"description": null,
	"note": "hi",
	"name": "Emily Test 1",
	"imgLeatherHard": null,
	"imgBisqueFired": null,
	"imgGlazed": null,
	"imgComplete": null,
	"imgGallery": null,
	"glazes": [
		{
			"id": 1,
			"glaze": "Clear"
		}
	]
}

returns

{
	"id": 12,
	"clayId": 1,
	"clay": "White",
	"shapeId": 1,
	"shape": "Coffee Cup",
	"statusId": 1,
	"status": "Wet",
	"weightLeatherHard": null,
	"weightBoneDry": null,
	"weightBisqueFired": null,
	"weightGlazed": null,
	"weightComplete": null,
	"dateCreated": null,
	"dateComplete": null,
	"description": null,
	"note": "hi",
	"name": "Emily Test 1",
	"imgLeatherHard": null,
	"imgBisqueFired": null,
	"imgGlazed": null,
	"imgComplete": null,
	"imgGallery": null,
	"glazes": [
		{
			"id": 1,
			"glaze": "Clear"
		}
	]
}

DELETE /api/v1/creations/9

returns

{
  deleted: `${deleted} item(s) have been deleted successfully`,
}

Glazes

GET /api/v1/glazes

Returns

```json
[
{
"id": 1,
"glaze": "Clear",
"underglaze": 0,
"in_use": 1
},
{
"id": 2,
"glaze": "White Matte",
"underglaze": 0,
"in_use": 1
},
{
"id": 3,
"glaze": "White Glossy",
"underglaze": 0,
"in_use": 1
},
{
"id": 4,
"glaze": "Black Matte",
"underglaze": 0,
"in_use": 1
},
{
"id": 5,
"glaze": "Black Glossy",
"underglaze": 0,
"in_use": 1
},
{
"id": 6,
"glaze": "Haystack",
"underglaze": 0,
"in_use": 1
},
{
"id": 7,
"glaze": "Astronaut",
"underglaze": 0,
"in_use": 1
},
{
"id": 8,
"glaze": "Green Forrest",
"underglaze": 0,
"in_use": 1
},
{
"id": 9,
"glaze": "Black",
"underglaze": 1,
"in_use": 1
},
{
"id": 10,
"glaze": "White",
"underglaze": 1,
"in_use": 1
},
{
"id": 11,
"glaze": "Peach",
"underglaze": 1,
"in_use": 1
}
]
```

GET /api/v1/glazes/:id

POST /api/v1/glazes

Sends

```json
[
{
"glaze": "Clear"
},
{
"glaze": "Blue Pebble"
}
]
```

Returns

```json
[
{
"id": 17,
"glaze": "Clear"
},
{
"id": 18,
"glaze": "Blue Pebble"
}
]
```

PATCH /api/v1/glazes/:id

Send

```json
{
"glaze": "Blue Pebble"
}
```

Returns

```json
[
{
"id": 2,
"glaze": "Blue Pebble",
"underglaze": 0,
"in_use": 1
}
]
```

DELETE /api/v1/glazes/:id

Shapes

GET /api/v1/shapes

Returns

```json
[
{
"id": 1,
"shape": "Coffee Cup",
"in_use": 1
},
{
"id": 2,
"shape": "Plate",
"in_use": 1
},
{
"id": 3,
"shape": "Bowl",
"in_use": 1
},
{
"id": 4,
"shape": "Paint Palette",
"in_use": 1
},
{
"id": 5,
"shape": "Vase",
"in_use": 1
},
{
"id": 6,
"shape": "Planter",
"in_use": 1
},
{
"id": 7,
"shape": "Artistic",
"in_use": 1
}
]
```

GET /api/v1/shapes/:id

POST /api/v1/shapes

Send

```json
[
{
"shape": "Espresso Mini Cup"
}
]
```

Returns

```json
[
{
"id": 8,
"shape": "Espresso Mini Cup"
}
]
```

PATCH /api/v1/shapes/:id

Send

```json
{
"shape": "Espresso Mini Cup"
}
```

Returns

```json
{
"id": 2,
"shape": "Espresso Mini Cup",
"in_use": 1
}
```

DELETE /api/v1/shapes/:id

Statuses

GET /api/v1/statuses

Returns

```json
[
{
"id": 1,
"status": "Wet"
},
{
"id": 2,
"status": "Leather Hard"
},
{
"id": 3,
"status": "Bone Dry"
},
{
"id": 4,
"status": "Bisque Firing"
},
{
"id": 5,
"status": "Bisque Fired"
},
{
"id": 6,
"status": "Glazed"
},
{
"id": 7,
"status": "Glaze Firing"
},
{
"id": 8,
"status": "Complete"
}
]
```

GET /api/v1/statuses/:id

POST /api/v1/statuses

Sends

```json
[
{
"status": "Espresso Mini Cup"
}
]
```

Returns

```json
[
{
"id": 9,
"status": "Espresso Mini Cup"
}
]
```

PATCH /api/v1/statuses/:id

Send

```json
{
"status": "Awaiting Pick Up"
}
```

Returns

```json
{
"id": 2,
"status": "Awaiting Pick Up"
}
```

DELETE /api/v1/statuses/:id