From 5c4151c8d8f62e31d356e8e74911e0c1226f86d6 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Tue, 25 Feb 2020 18:13:24 +0100 Subject: [PATCH] Add single type endpoint doc Signed-off-by: Alexandre Bodin --- .../3.0.0-beta.x/content-api/api-endpoints.md | 172 ++++++++++++------ 1 file changed, 116 insertions(+), 56 deletions(-) diff --git a/docs/3.0.0-beta.x/content-api/api-endpoints.md b/docs/3.0.0-beta.x/content-api/api-endpoints.md index 5c2bcd13b5..1e0617564e 100644 --- a/docs/3.0.0-beta.x/content-api/api-endpoints.md +++ b/docs/3.0.0-beta.x/content-api/api-endpoints.md @@ -4,9 +4,10 @@ When you create a `Content Type` you will have a certain number of **REST API en As an **example**, let's consider the following models: -**Content Type**: +**Content Types**: -- `Restaurant` +- `Restaurant` **(Collection Type)** +- `Homepage` **(Single Type)** **Components**: @@ -14,18 +15,31 @@ As an **example**, let's consider the following models: - `Title With Subtitle` (category: `content`) - `Image With Description` (category: `content`) +--- + :::: tabs ::: tab "Content Types" ### `Restaurant` Content Type -| Fields | Type | Description | Options | -| :------------ | :---------- | :----------------------------------- | :----------- | -| name | string | Restaurant's title | | -| cover | media | Restaurant's cover image | | -| content | dynamiczone | The restaurant profile content | | -| opening_hours | component | Restaurant's opening hours component | `repeatable` | +| Fields | Type | Description | Options | +| :------------ | :---------- | :----------------------------------- | :------------------- | +| name | string | Restaurant's title | | +| slug | uid | Restaurant's slug | `targetField="name"` | +| cover | media | Restaurant's cover image | | +| content | dynamiczone | The restaurant profile content | | +| opening_hours | component | Restaurant's opening hours component | `repeatable` | + +--- + +### `Homepage` Content Type + +| Fields | Type | Description | Options | +| :------- | :---------- | :----------------- | :------ | +| title | string | Homepage title | | +| subTitle | string | Homepage sub title | | +| content | dynamiczone | Homepage content | | ::: @@ -91,21 +105,67 @@ Here is the list of endpoints generated for each of your **Content Types**. +:::: tabs + +::: tab "Collection Type" +
-| Method | Path | Description | -| :----- | :---------------------------------------------- | :----------------------------------- | -| GET | [/{content-type}](#get-restaurants) | Get a list of {content-type} entries | -| GET | [/{content-type}/:id](#get-restaurants-id) | Get a specific {content-type} entry | -| GET | [/{content-type}/count](#get-restaurants-count) | Count {content-type} entries | -| POST | [/{content-type}](#post-restaurants) | Create a {content-type} entry | -| DELETE | [/{content-type}/:id](#delete-restaurants-id) | Delete a {content-type} entry | -| PUT | [/{content-type}/:id](#put-restaurants-id) | Update a {content-type} entry | +| Method | Path | Description | +| :----- | :---------------------- | :----------------------------------- | +| GET | `/{content-type}` | Get a list of {content-type} entries | +| GET | `/{content-type}/:id` | Get a specific {content-type} entry | +| GET | `/{content-type}/count` | Count {content-type} entries | +| POST | `/{content-type}` | Create a {content-type} entry | +| DELETE | `/{content-type}/:id` | Delete a {content-type} entry | +| PUT | `/{content-type}/:id` | Update a {content-type} entry |
+::: + +::: tab "Single Type" + +
+ +| Method | Path | Description | +| :----- | :---------------- | :-------------------------------- | +| GET | `/{content-type}` | Get a the {content-type} content | +| PUT | `/{content-type}` | Update the {content-type} content | +| DELETE | `/{content-type}` | Delete the {content-type} content | + +
+ +::: + +:::: + ### Here are some Content Type examples +### Single Types + +:::: tabs + +::: tab Homepage + +`Homepage` **Content Type** + +
+ +| Method | Path | Description | +| :----- | :---------- | :-------------------------- | +| GET | `/homepage` | Get the homepage content | +| PUT | `/homepage` | Update the homepage content | +| DELETE | `/homepage` | Delete the homepage content | + +
+ +::: + +:::: + +### Collection Types + :::: tabs ::: tab Restaurant @@ -114,14 +174,14 @@ Here is the list of endpoints generated for each of your **Content Types**.
-| Method | Path | Description | -| :----- | :----------------- | :------------------------ | -| GET | /restaurants | Get a list of restaurants | -| GET | /restaurants/:id | Get a specific restaurant | -| GET | /restaurants/count | Count restaurants | -| POST | /restaurants | Create a restaurant | -| DELETE | /restaurants/:id | Delete a restaurant | -| PUT | /restaurants/:id | Update a restaurant | +| Method | Path | Description | +| :----- | :------------------- | :------------------------ | +| GET | `/restaurants` | Get a list of restaurants | +| GET | `/restaurants/:id` | Get a specific restaurant | +| GET | `/restaurants/count` | Count restaurants | +| POST | `/restaurants` | Create a restaurant | +| DELETE | `/restaurants/:id` | Delete a restaurant | +| PUT | `/restaurants/:id` | Update a restaurant |
@@ -133,14 +193,14 @@ Here is the list of endpoints generated for each of your **Content Types**.
-| Method | Path | Description | -| :----- | :-------------- | :--------------------- | -| GET | /articles | Get a list of articles | -| GET | /articles/:id | Get a specific article | -| GET | /articles/count | Count articles | -| POST | /articles | Create a article | -| DELETE | /articles/:id | Delete a article | -| PUT | /articles/:id | Update a article | +| Method | Path | Description | +| :----- | :---------------- | :--------------------- | +| GET | `/articles` | Get a list of articles | +| GET | `/articles/:id` | Get a specific article | +| GET | `/articles/count` | Count articles | +| POST | `/articles` | Create a article | +| DELETE | `/articles/:id` | Delete a article | +| PUT | `/articles/:id` | Update a article |
@@ -152,14 +212,14 @@ Here is the list of endpoints generated for each of your **Content Types**.
-| Method | Path | Description | -| :----- | :-------------- | :--------------------- | -| GET | /products | Get a list of products | -| GET | /products/:id | Get a specific product | -| GET | /products/count | Count products | -| POST | /products | Create a product | -| DELETE | /products/:id | Delete a product | -| PUT | /products/:id | Update a product | +| Method | Path | Description | +| :----- | :---------------- | :--------------------- | +| GET | `/products` | Get a list of products | +| GET | `/products/:id` | Get a specific product | +| GET | `/products/count` | Count products | +| POST | `/products` | Create a product | +| DELETE | `/products/:id` | Delete a product | +| PUT | `/products/:id` | Update a product |
@@ -171,14 +231,14 @@ Here is the list of endpoints generated for each of your **Content Types**.
-| Method | Path | Description | -| :----- | :---------------- | :----------------------- | -| GET | /categories | Get a list of categories | -| GET | /categories/:id | Get a specific category | -| GET | /categories/count | Count categories | -| POST | /categories | Create a category | -| DELETE | /categories/:id | Delete a category | -| PUT | /categories/:id | Update a category | +| Method | Path | Description | +| :----- | :------------------ | :----------------------- | +| GET | `/categories` | Get a list of categories | +| GET | `/categories/:id` | Get a specific category | +| GET | `/categories/count` | Count categories | +| POST | `/categories` | Create a category | +| DELETE | `/categories/:id` | Delete a category | +| PUT | `/categories/:id` | Update a category |
@@ -190,14 +250,14 @@ Here is the list of endpoints generated for each of your **Content Types**.
-| Method | Path | Description | -| :----- | :---------- | :----------------- | -| GET | /tags | Get a list of tags | -| GET | /tags/:id | Get a specific tag | -| GET | /tags/count | Count tags | -| POST | /tags | Create a tag | -| DELETE | /tags/:id | Delete a tag | -| PUT | /tags/:id | Update a tag | +| Method | Path | Description | +| :----- | :------------ | :----------------- | +| GET | `/tags` | Get a list of tags | +| GET | `/tags/:id` | Get a specific tag | +| GET | `/tags/count` | Count tags | +| POST | `/tags` | Create a tag | +| DELETE | `/tags/:id` | Delete a tag | +| PUT | `/tags/:id` | Update a tag |