|
1 | 1 | <img |
2 | | - src="https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt2c341bd633887e37/Contentstack-LogoLockup-AmethystShadowHeavy-RGB.png" /> |
3 | | -<br> |
4 | | -<p> |
5 | | -Contentstack provides OpenAPI files for its <a href="https://www.contentstack.com/docs/developers/apis/content-delivery-api">Content Delivery</a> and <a href="https://www.contentstack.com/docs/developers/apis/content-management-api">Content Management</a> APIs in JSON format. These files allow you to automatically generate API documentation, test requests, and streamline your development workflow. |
6 | | -</p> |
7 | | -<p> |
8 | | -This tutorial walks you through how to use these JSON files with Swagger Editor to interact with Contentstack’s APIs. |
| 2 | + src="https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/bltddc0acd6b98c881c/Contentstack-Logo" width="70" height="75"> |
| 3 | +<h1>Contentstack CDA/CMA OpenAPI</h1> |
| 4 | +<p>Contentstack provides OpenAPI files for its Content Delivery and Content Management REST APIs. These files are in |
| 5 | + JSON format. Using these JSON files, you can automatically generate API documentation, test API, and do a lot more. |
9 | 6 | </p> |
| 7 | +<p>This tutorial will walk you through the process of using Contentstack APIs (Content Delivery and Content Management |
| 8 | + APIs) with Swagger.</p><br> |
10 | 9 | <h2>Content Delivery API (CDA)</h2> |
11 | | - |
12 | | - |
13 | | -<p> |
14 | | -To use CDA with Swagger, follow these steps: |
15 | | -</p> |
| 10 | +<p>Version: 3.0.0 <a |
| 11 | + href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/bltcca6e1e737dabee0/cda-openapi-3.json?v=3.0.0&disposition=download">[Download]</a></p> |
| 12 | +<p>Last Updated: Feb 06, 2023</p> |
| 13 | +<p><strong>Note</strong>: To use the latest version, <a |
| 14 | + href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/bltcca6e1e737dabee0/cda-openapi-3.json?v=3.0.0&disposition=download">download |
| 15 | + the CDA file</a> on your system. </p> |
| 16 | +<p>To use Contentstack Content Delivery API (CDA) with Swagger, perform the following steps: </p> |
16 | 17 | <ol> |
17 | | - |
18 | | -<li><a href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/bltcca6e1e737dabee0/cda-openapi-3.json?v=3.0.0&disposition=download">Download the latest CDA JSON file</a> and navigate to <a href="https://editor.swagger.io/">Swagger Editor</a>.</li> |
19 | | - |
20 | | -<li>Click <strong>File</strong> on top-right and select <strong>Import File</strong> to upload the JSON.</li> |
21 | | - |
22 | | -<li>Open any API request and click the <strong>Try it out</strong> button to unlock the parameter fields.</li> |
23 | | - |
24 | | -<li>Enter your stack's values or use the default demo stack credentials.</li> |
25 | | - |
26 | | -<li>Click <strong>Execute</strong>.</li> |
| 18 | + <li><a |
| 19 | + href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/bltcca6e1e737dabee0/cda-openapi-3.json?v=3.0.0&disposition=download">Download |
| 20 | + the CDA file</a> and go to the <a href="https://editor.swagger.io/">Swagger Editor</a>.</li> |
| 21 | + <li>On the “Swagger Editor” page, click on <strong>File</strong>, and select the <strong>Import file</strong> option. |
| 22 | + </li> |
27 | 23 | </ol> |
28 | | -<p> |
29 | | -The <strong>Responses</strong> section will display the following: |
30 | | -</p> |
| 24 | +<p>Alternatively, if you want to use the Import URL option, you can <a |
| 25 | + href="https://www.contentstack.com/docs/content-managers/working-with-assets/create-upload-assets/">upload the CDA |
| 26 | + file as an asset</a> in Contentstack, and then paste the asset’s URL in the prompt.</p> |
| 27 | +<ol> |
| 28 | + <li>Open any API request and click on the <strong>Try it out </strong>button. Clicking this button will unlock the |
| 29 | + fields, so you can either run the API request on our demo stack or can use your own values.</li> |
| 30 | + <li>Click on <strong>Execute</strong>.</li> |
| 31 | +</ol><br> |
| 32 | +<p>In the <strong>Responses </strong>section, you can see the following details:</p> |
31 | 33 | <ul> |
32 | | - |
33 | | -<li>The API request in cURL format.</li> |
34 | | - |
35 | | -<li>The response body (JSON).</li> |
36 | | - |
37 | | -<li>The HTTP status code.</li> |
38 | | -</ul> |
39 | | -<p> |
40 | | -<strong>Note</strong>: To ensure you are testing against the most accurate environment, always download the latest CDA file from the Contentstack documentation site. |
41 | | -</p> |
42 | | -<h2>Content Management API (CMA)</h2> |
43 | | - |
44 | | - |
45 | | -<p> |
46 | | -To use CDA with Swagger, follow these steps: |
47 | | -</p> |
| 34 | + <li>API request in CURL format</li> |
| 35 | + <li>Response body</li> |
| 36 | + <li>Status code </li> |
| 37 | +</ul><br> |
| 38 | +<h2>Content Management API</h2> |
| 39 | +<p>Version: 3.0.0 <a |
| 40 | + href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/blt85399a97399b4ecf/cma-openapi-3.json?v=3.0.1&disposition=download">[Download]</a></p> |
| 41 | +<p>Last Updated: Feb 06, 2023</p> |
| 42 | +<p><strong>Note</strong>: To use the latest version, <a |
| 43 | + href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/blt85399a97399b4ecf/cma-openapi-3.json?v=3.0.1&disposition=download">download |
| 44 | + the CMA file</a> on your system. </p> |
| 45 | +<p>To use Contentstack Content Management API (CMA) with Swagger, perform the following steps: </p> |
48 | 46 | <ol> |
49 | | - |
50 | | -<li><a href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/blt85399a97399b4ecf/cma-openapi-3.json?v=3.0.1&disposition=download">Download the latest CMA JSON file</a> and navigate to <a href="https://editor.swagger.io/">Swagger Editor</a>.</li> |
51 | | - |
52 | | -<li>Click <strong>File</strong> on top-right and select <strong>Import File</strong> to upload the JSON.</li> |
53 | | - |
54 | | -<li>Before running a request, ensure you have an authentication method ready:</li> |
55 | | - |
56 | | -<li><strong>Management Token</strong>: We recommend using a management token for CMA requests. Refer to the <a href="https://www.contentstack.com/docs/developers/create-tokens/generate-a-management-token">Generate Management Token</a> guide for details.</li> |
57 | | - |
58 | | -<li><strong>Authtoken</strong>: Run the <a href="https://www.contentstack.com/docs/developers/apis/content-management-api#log-in-to-your-account">Log in API request</a> under the <strong>User Session</strong> section to retrieve an <code>authtoken</code> in the response.</li> |
59 | | - |
60 | | -<li>Open any API request and click the <strong>Try it out</strong> button to unlock the parameter fields.</li> |
61 | | - |
62 | | -<li>Enter your stack's values or use the default demo stack credentials.</li> |
63 | | - |
64 | | -<li>Click <strong>Execute</strong>.</li> |
65 | | -</ol> |
66 | | -<p> |
67 | | -The <strong>Responses</strong> section will display the following: |
68 | | -</p> |
| 47 | + <li><a |
| 48 | + href="https://assets.contentstack.io/v3/assets/blt02f7b45378b008ee/blt85399a97399b4ecf/cma-openapi-3.json?v=3.0.1&disposition=download">Download |
| 49 | + the CMA file</a> and go to the <a href="https://editor.swagger.io/">Swagger Editor</a>. </li> |
| 50 | + <li>On the “Swagger Editor” page, click on<strong> File</strong>, and select the <strong>Import file </strong>option. |
| 51 | + </li> |
| 52 | + <li>Alternatively, you can <a |
| 53 | + href="https://www.contentstack.com/docs/content-managers/working-with-assets/create-upload-assets/">upload the CMA |
| 54 | + file as an asset</a> in Contentstack. Then, you can use the <strong>Import URL</strong> option and paste the |
| 55 | + asset’s URL in the prompt. </li> |
| 56 | + <li>To run any API request for CMA, make sure you have either the Management token or Auth token in hand. <ol> |
| 57 | + <li>To use a management token, refer to the Generate Management token guide. </li> |
| 58 | + <li>To use Auth token, run the <strong>Login </strong>API request, located under the <strong>User Session |
| 59 | + </strong>section. </li> |
| 60 | + </ol> |
| 61 | + </li> |
| 62 | + <li>Open any API request and click on the <strong>Try it out</strong> button. Clicking this button will unlock the |
| 63 | + fields for you to use your enter the values. </li> |
| 64 | + <li>Click <strong>Execute</strong>.</li> |
| 65 | +</ol><br> |
| 66 | +<p>In the <strong>Responses </strong>section, you can see the following details:</p> |
69 | 67 | <ul> |
70 | | - |
71 | | -<li>The API request in cURL format.</li> |
72 | | - |
73 | | -<li>The response body (JSON).</li> |
74 | | - |
75 | | -<li>The HTTP status code.</li> |
| 68 | + <li>API request in CURL format</li> |
| 69 | + <li>Response body</li> |
| 70 | + <li>Status code</li> |
76 | 71 | </ul> |
77 | | -<p> |
78 | | -<strong>Note</strong>: |
79 | | -</p> |
| 72 | +<h2>Points to note:</h2> |
80 | 73 | <ul> |
81 | | - |
82 | | -<li>We recommend using the Management token for executing CMA requests rather than authtoken.</li> |
83 | | - |
84 | | -<li>For any DELETE request that has a request body in it, you won’t be able to run it in Swagger.</li></ul |
| 74 | + <li>We recommend using the Management token for executing CMA requests rather than Auth token. </li> |
| 75 | + <li>For any DELETE request that has a request body in it, you won’t be able to run it in Swagger. In such scenarios, |
| 76 | + refer to the documentation link provided in the call for more details.</li> |
| 77 | +</ul><br> |
0 commit comments