### GET Request Example Source: https://docusaurus-openapi.tryingpan.dev/tests/example-in-request-parameters This example shows a GET request to a local test server. It includes query parameters for name, age, and isStudent. Ensure the server is running at http://test.local:8080. ```http GET ## http://test.local:8080/requestParameters/example ``` -------------------------------- ### GET /redirect-to Example Source: https://docusaurus-openapi.tryingpan.dev/httpbin/get-redirect-to Demonstrates how to perform a GET request to the /redirect-to endpoint to test URL redirection. Requires the 'url' query parameter. ```http GET https://httpbin.org/redirect-to ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/petstore31/find-pets-by-tags An example of how to make a GET request to the Petstore API using Python's http.client library. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/v2", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET /response/schema/properties/example Source: https://docusaurus-openapi.tryingpan.dev/tests/example-of-schema-properties-in-response Retrieves an example response with schema properties. ```APIDOC ## GET /response/schema/properties/example ### Description Retrieves an example response with schema properties. ### Method GET ### Endpoint http://test.local:8080/response/schema/properties/example ### Parameters ### Request Body ### Request Example ### Response #### Success Response (200) - **name** (string) - - **age** (number) - - **isStudent** (boolean) - #### Response Example ```json { "name": "John Doe", "age": 25, "isStudent": false } ``` ``` -------------------------------- ### GET Request with Schema Example Source: https://docusaurus-openapi.tryingpan.dev/tests/example-in-request-parameters-schema This is an example of a GET request to a local test server, demonstrating the structure of request parameters in an OpenAPI schema. ```http GET ## http://test.local:8080/requestParameters/schema/example ``` -------------------------------- ### HTTP Client Request Example Source: https://docusaurus-openapi.tryingpan.dev/tests/get-user-by-id A Python example using the http.client library to perform the GET request. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = {} conn.request("GET", "/users/:userId", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET /requestParameters/schema/examples Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-in-request-parameters-schema Retrieves examples based on the defined request parameters schema. ```APIDOC ## GET /requestParameters/schema/examples ### Description Retrieves examples based on the defined request parameters schema. ### Method GET ### Endpoint http://test.local:8080/requestParameters/schema/examples ### Parameters #### Query Parameters - **name** (string) - Optional - name example. Examples: "John Doe", "Jane Smith" - **age** (number) - Optional - age example. Examples: 25, 30 - **isStudent** (boolean) - Optional - isStudent example. Examples: true, false ### Response #### Success Response (204) - No content ``` -------------------------------- ### GET /response/schema/example Source: https://docusaurus-openapi.tryingpan.dev/tests/example-of-schema-in-response Retrieves an example response with a defined schema. ```APIDOC ## GET /response/schema/example ### Description Retrieves an example response with a defined schema. ### Method GET ### Endpoint http://test.local:8080/response/schema/example ### Response #### Success Response (200) - **name** (string) - Description of the name field. - **age** (number) - Description of the age field. - **isStudent** (boolean) - Description of the isStudent field. #### Response Example ```json { "name": "John Doe", "age": 25, "isStudent": false } ``` ``` -------------------------------- ### HTTP Client Request Example (Python) Source: https://docusaurus-openapi.tryingpan.dev/tests/all-of-with-array-items Example of how to make a GET request to the /v1/allof-array-items endpoint using Python's http.client. ```APIDOC ## HTTP Client Request Example (Python) ### Description This snippet shows how to fetch the list of books using Python's `http.client` library. ### Code ```python import http.client conn = http.client.HTTPSConnection("api.example.com") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/v1/allof-array-items", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/tests/any-of-with-primitives Example of making a GET request to the /anyof-primitives endpoint using Python's http.client. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/anyof-primitives", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET /response/mediaTypeObject/example Source: https://docusaurus-openapi.tryingpan.dev/tests/example-of-media-type-object-in-response This endpoint returns an example of a response with a media type object, showcasing different data formats and examples. ```APIDOC ## GET /response/mediaTypeObject/example ### Description This endpoint returns an example of a response with a media type object, showcasing different data formats and examples. ### Method GET ### Endpoint http://test.local:8080/response/mediaTypeObject/example ### Parameters ### Request Body ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **name** (string) - Description - **age** (number) - Description - **isStudent** (boolean) - Description #### Response Example ```json { "name": "John Doe", "age": 25, "isStudent": false } ``` ``` -------------------------------- ### Python HTTP Request Example Source: https://docusaurus-openapi.tryingpan.dev/petstore_versioned/find-pets-by-tags Example of making a GET request to the petstore API using Python's http.client. Ensure you replace '' with a valid access token. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/v2", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### HTTP GET Request for Products (Python) Source: https://docusaurus-openapi.tryingpan.dev/tests/get-product-by-code-matrix-style Example of making an HTTP GET request to retrieve product information using Python's http.client library. Ensure the connection details and endpoint are correct. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = {} conn.request("GET", "/products/;", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Perform GET request with Python Source: https://docusaurus-openapi.tryingpan.dev/tests/get-with-header-parameters Example using the http.client library to perform a GET request to the /headers endpoint. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = {} conn.request("GET", "/headers", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Example Request Parameters Source: https://docusaurus-openapi.tryingpan.dev/tests/get-document-with-header-parameter Provides a concrete example of how to format the path and header parameters for the request. ```text {docId} = "doc123" X-API-Version: ["v1", "v2"] Result URL: /documents/doc123 Header: X-API-Version: v1,v2 ``` -------------------------------- ### Path Parameter Substitution Example Source: https://docusaurus-openapi.tryingpan.dev/tests/path-parameters-in-the-same-segment Example showing how parameters are resolved into a final URL path. ```text {name} = "report" {ext} = "pdf" Result: /files/report.pdf ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/httpbin/get-anything-by-path Demonstrates making a GET request to the /anything/:anything endpoint using Python's http.client library. Ensure the connection is established to httpbin.org. ```python import http.client conn = http.client.HTTPSConnection("httpbin.org") payload = '' headers = {} conn.request("GET", "/anything/:anything", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### HTTP GET Request using http.client (Python) Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-of-media-type-object-in-response Demonstrates how to make an HTTP GET request to retrieve response examples using Python's http.client library. Ensure the 'Accept' header is set to 'application/json'. ```python import http.client conn = http.client.HTTPSConnection("test.local", undefined) payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/response/mediaTypeObject/examples", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Header parameter example Source: https://docusaurus-openapi.tryingpan.dev/tests/get-with-header-parameters Example showing how the X-Custom-Header object is serialized. ```text X-Custom-Header = {"key1": "value1", "key2": "value2"} Result: X-Custom-Header: key1=value1 X-Custom-Header: key2=value2 ``` -------------------------------- ### ModeC2 Configuration Example Source: https://docusaurus-openapi.tryingpan.dev/tests/schemas/modec-2 Example JSON object for configuring ModeC2. Ensure the 'mode' is set to 'mode-c2' and provide any required nested settings. ```json { "mode": "mode-c2", "settingC2": { "nested": "string" } } ``` -------------------------------- ### Get Item by ID Request Example Source: https://docusaurus-openapi.tryingpan.dev/tests/get-item-by-id-label-style Demonstrates how to construct a GET request to retrieve an item by its ID, with the ID specified in a label-style path parameter. ```http GET ## /items/:itemId ``` itemId: in: path required: true schema: type: array items: type: integer style: label explode: false ``` Example: ``` {itemId} = [1, 2, 3] Result: /items/.1.2.3 ``` ``` -------------------------------- ### Request Body Example Source: https://docusaurus-openapi.tryingpan.dev/tests/schema-with-examples-array-oas-3-1 This is an example of a request body that conforms to the schema with an `examples` array. It shows one of the provided examples. ```json { "name": "John Doe", "age": 30 } ``` -------------------------------- ### Schema example vs examples comparison Source: https://docusaurus-openapi.tryingpan.dev/tests/schema-examples-api-oas-3-1 Provides a comparison between the single 'example' field and the 'examples' array field. ```APIDOC ## Schema example vs examples comparison ### Description Demonstrates the functional and structural differences between using a single `example` field versus an `examples` array for schema documentation. ``` -------------------------------- ### Path Parameter Example Source: https://docusaurus-openapi.tryingpan.dev/tests/get-user-by-id An example showing how the userId parameter is interpolated into the path. ```text {userId} = 123 Result: /users/123 ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/tests/one-of-with-primitive-format-types Demonstrates how to make a GET request to the /oneof-primitive-formats endpoint using Python's http.client. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/oneof-primitive-formats", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### HTTP Client Implementation in Python Source: https://docusaurus-openapi.tryingpan.dev/httpbin/get-deny Example usage of the http.client library to perform a GET request to the /deny endpoint. ```python import http.client conn = http.client.HTTPSConnection("httpbin.org") payload = '' headers = {} conn.request("GET", "/deny", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### POST /schema-examples-array Source: https://docusaurus-openapi.tryingpan.dev/tests/schema-with-examples-array-oas-3-1 Endpoint to create a user using a schema that supports multiple examples via the OpenAPI 3.1 examples array. ```APIDOC ## POST /schema-examples-array ### Description This endpoint accepts a request body containing a name and age, demonstrating the use of schema-level examples in OpenAPI 3.1. ### Method POST ### Endpoint /schema-examples-array ### Parameters #### Request Body - **name** (string) - Required - The name of the user. - **age** (integer) - Required - The age of the user. ### Request Example { "name": "John Doe", "age": 30 } ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the created user. - **message** (string) - A confirmation message. #### Response Example { "id": 1, "message": "User created successfully" } ``` -------------------------------- ### Cookie parameter example Source: https://docusaurus-openapi.tryingpan.dev/tests/get-with-cookie-parameters Example of the userSettings object and its resulting serialized format. ```text userSettings = {"theme": "dark", "language": "en"} Result: userSettings=theme,dark,language,en ``` -------------------------------- ### Order status examples Source: https://docusaurus-openapi.tryingpan.dev/petstore31/place-order Example JSON payloads for different order states. ```json { "quantity": 4, "shipDate": "2022-10-12", "status": "delivered", "requestId": "444-4444-444-4444" } ``` ```json { "quantity": 10, "shipDate": "2022-10-01", "status": "placed", "requestId": "111-222-333-444" } ``` ```json { "quantity": 1000, "shipDate": "2022-09-01", "status": "approved", "requestId": "000-111-222-333" } ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/petstore31/get-pet-by-id This snippet shows how to make a GET request using Python's http.client library with API key authentication. Replace '' with your actual API key. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = { 'Accept': 'application/json', 'api_key': '' } conn.request("GET", "/v2/pet/findByTags", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### HTTP Client Request in Python Source: https://docusaurus-openapi.tryingpan.dev/tests/object-with-schema-defined-additional-properties Example of how to perform a GET request to the endpoint using the Python http.client library. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/with-schema-additional", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### HTTP Client Request Implementation Source: https://docusaurus-openapi.tryingpan.dev/petstore_versioned/logout-user Example implementation using the Python http.client library to perform a GET request. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = {} conn.request("GET", "/v2", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Example User Settings Cookie Source: https://docusaurus-openapi.tryingpan.dev/tests/get-user-preferences-with-cookie-parameter Provides an example of how to format the 'userSettings' cookie with theme and language preferences. This demonstrates the expected structure for the cookie value. ```text userSettings = {"theme": "dark", "language": "en"} Result URL: /preferences Cookie: theme=dark; language=en ``` -------------------------------- ### HTTP Client Request Implementation Source: https://docusaurus-openapi.tryingpan.dev/petstore/logout-user Example implementation using the Python http.client library to perform a GET request. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = {} conn.request("GET", "/v2", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### HTTP Client Request Implementation Source: https://docusaurus-openapi.tryingpan.dev/petstore/login-user Example implementation using Python's http.client library to perform the GET request. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/v2", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-of-schema-in-response Example of how to perform a GET request using the Python http.client library. ```python import http.client conn = http.client.HTTPSConnection("test.local", undefined) payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/response/schema/examples", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/petstore/get-order-by-id Example of how to make a GET request to find a purchase order using Python's http.client. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/v2/store/order/:orderId", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Order Request Body Examples Source: https://docusaurus-openapi.tryingpan.dev/petstore/place-order Example JSON payloads for different order states. ```json { "quantity": 4, "shipDate": "2022-10-12", "status": "delivered", "requestId": "444-4444-444-4444" } ``` ```json { "quantity": 10, "shipDate": "2022-10-01", "status": "placed", "requestId": "111-222-333-444" } ``` ```json { "quantity": 1000, "shipDate": "2022-09-01", "status": "approved", "requestId": "000-111-222-333" } ``` -------------------------------- ### GET /response/mediaTypeObject/examples Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-of-media-type-object-in-response This endpoint demonstrates the use of media type objects in responses, providing examples for JSON payloads. ```APIDOC ## GET /response/mediaTypeObject/examples ### Description This endpoint returns examples of a response with a media type object, showcasing different JSON payloads. ### Method GET ### Endpoint http://test.local:8080/response/mediaTypeObject/examples ### Parameters ### Request Body None ### Response #### Success Response (200) - **application/json** - **Schema** - **name** (string) - **age** (number) - **isStudent** (boolean) - **Example 1** ```json { "name": "John Doe", "age": 25, "isStudent": true } ``` - **Example 2** ```json { "name": "Jane Smith", "age": 30, "isStudent": false } ``` #### Response Example (application/json) ```json { "name": "string", "age": 0, "isStudent": true } ``` ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/tests/discriminator-with-nested-schemas-and-mapping This Python code snippet demonstrates how to make a GET request to the /discriminator-nested-mapping endpoint using the http.client library and print the response. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/discriminator-nested-mapping", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Response Schema Example Source: https://docusaurus-openapi.tryingpan.dev/tests/all-of-with-multiple-one-of-constraints Example JSON response for a successful creation. ```json { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "message": "Resource created successfully" } ``` -------------------------------- ### HTTP Client Request Example Source: https://docusaurus-openapi.tryingpan.dev/tests/file-part-with-multiple-selectable-content-types Example implementation using Python's http.client to perform a multipart/form-data POST request. ```python import http.client import mimetypes from codecs import encode conn = http.client.HTTPSConnection("httpbin.org") boundary = '' payload = '' headers = { 'Content-Type': 'multipart/form-data', 'Content-type': 'multipart/form-data; boundary={}'.format(boundary) } conn.request("POST", "/anything/multi-content-type", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Developer Quick Start Source: https://docusaurus-openapi.tryingpan.dev/ Commands to set up the development environment after forking the repository. ```bash git clone https://github.com//docusaurus-openapi-docs.git cd docusaurus-openapi-docs yarn yarn build-packages yarn watch:demo ``` -------------------------------- ### Successful Response Example Source: https://docusaurus-openapi.tryingpan.dev/tests/schema-with-examples-array-oas-3-1 This is an example of a successful response (200 OK) after creating a user. It includes the schema for the response. ```json { "id": 1, "message": "User created successfully" } ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/httpbin/get-links This snippet shows how to make a GET request to the /links/:n/:offset endpoint using Python's http.client library. Ensure you have the http.client library available in your Python environment. ```python import http.client conn = http.client.HTTPSConnection("httpbin.org") payload = '' headers = {} conn.request("GET", "/links/:n/:offset", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### XML Response Example Source: https://docusaurus-openapi.tryingpan.dev/petstore/get-order-by-id Example of a successful XML response when retrieving a purchase order. ```xml 0 0 1 2024-07-29T15:51:28.071Z placed false ``` -------------------------------- ### Product Code Matrix Style Example Source: https://docusaurus-openapi.tryingpan.dev/tests/get-product-by-code-matrix-style Illustrates how to format the productCode when using matrix style. The example shows the input object and the resulting URL path. ```text {productCode} = {"category": "electronics", "id": 123} Result: /products;category=electronics;id=123 ``` -------------------------------- ### docusaurus.config.ts Configuration Example Source: https://docusaurus-openapi.tryingpan.dev/ An example of how to configure `docusaurus.config.ts` to integrate `docusaurus-plugin-openapi-docs` and `docusaurus-theme-openapi-docs`. ```APIDOC ## Configuring `docusaurus.config.ts` (Plugin and theme usage) Here is an example of properly configuring `docusaurus.config.ts` for `docusaurus-plugin-openapi-docs` and `docusaurus-theme-openapi-docs` usage. note Instructions may differ slightly for sites that haven't migrated to typescript. ```typescript // docusaurus.config.ts // note that parts of the complete config were left out for brevity import type * as Preset from "@docusaurus/preset-classic"; import type { Config } from "@docusaurus/types"; import type * as Plugin from "@docusaurus/types/src/plugin"; import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs"; const config: Config = { presets: [ [ "classic", { docs: { sidebarPath: "./sidebars.ts", docItemComponent: "@theme/ApiItem", // Derived from docusaurus-theme-openapi }, theme: { customCss: "./src/css/custom.css", }, } satisfies Preset.Options, ], ], plugins: [ [ 'docusaurus-plugin-openapi-docs', { id: "api", // plugin id docsPluginId: "classic", // configured for preset-classic config: { petstore: { specPath: "examples/petstore.yaml", outputDir: "docs/petstore", sidebarOptions: { groupPathsBy: "tag", }, } satisfies OpenApiPlugin.Options, } }, ] ], themes: ["docusaurus-theme-openapi-docs"], // export theme components }; export default config; ``` > Note: You may optionally configure a dedicated `@docusaurus/plugin-content-docs` instance for use with `docusaurus-theme-openapi-docs` by setting `docItemComponent` to `@theme/ApiItem`. ``` -------------------------------- ### Schema with examples array (OAS 3.1) Source: https://docusaurus-openapi.tryingpan.dev/tests/schema-examples-api-oas-3-1 Explains the usage of the examples array at the schema level in OpenAPI 3.1. ```APIDOC ## Schema with examples array (OAS 3.1) ### Description OpenAPI 3.1 allows the definition of `examples` at the schema level as an array of values, providing multiple example representations for a single schema. ``` -------------------------------- ### Response Schema Examples Source: https://docusaurus-openapi.tryingpan.dev/petstore/login-user Example response bodies for successful and unsuccessful login attempts. ```json "string" ``` ```text OK ``` ```json "string" ``` ```xml OK ``` -------------------------------- ### Python HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-in-request-parameters-schema Example of using the http.client library to perform a GET request to the schema examples endpoint. ```python import http.client conn = http.client.HTTPSConnection("test.local", undefined) payload = '' headers = {} conn.request("GET", "/requestParameters/schema/examples", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Create a bucket using Python Source: https://docusaurus-openapi.tryingpan.dev/cos/create-a-bucket Example implementation using the http.client library to send a PUT request for bucket creation. ```python import http.client conn = http.client.HTTPSConnection("s3.us.cloud-object-storage.appdomain.cloud") payload = '' headers = { 'Content-Type': 'text/plain', 'Authorization': 'Bearer ' } conn.request("PUT", "/:bucketName", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### POST /anything/request-body-with-example Source: https://docusaurus-openapi.tryingpan.dev/tests/regular-endpoint-with-schema-level-example-regression-guard Verifies that the schema-level example renders correctly for request bodies. ```APIDOC ## POST /anything/request-body-with-example ### Description Verifies that the schema-level example renders correctly for request bodies. ### Method POST ### Endpoint https://httpbin.org/anything/request-body-with-example ### Parameters #### Request Body - **id** (string) - Required - Unique event identifier. - **type** (string) - Required - Event type slug. - **payload** (object) - Required - Event-specific data. ### Request Example { "id": "evt_001", "type": "order.created", "payload": { "orderId": "ORD-123", "total": 29.99 } } ### Response #### Success Response (200) - OK ``` -------------------------------- ### POST /schema-example-vs-examples Source: https://docusaurus-openapi.tryingpan.dev/tests/schema-example-vs-examples-comparison Demonstrates how different example definitions (schema.example vs schema.examples) are handled in the API documentation. ```APIDOC ## POST /schema-example-vs-examples ### Description Demonstrates the difference between schema.example, schema.examples, and content-level examples. ### Method POST ### Endpoint /schema-example-vs-examples ### Request Body - **status** (string) - Required - Possible values: [active, inactive, pending] - **count** (integer) - Required - Must be >= 0 ### Request Example { "status": "active", "count": 10 } ### Response #### Success Response (200) - Successful response #### Response Example { "status": "active", "count": 10 } ``` -------------------------------- ### JSON Response Example Source: https://docusaurus-openapi.tryingpan.dev/petstore/get-order-by-id Example of a successful JSON response when retrieving a purchase order. ```json { "id": 0, "petId": 0, "quantity": 1, "shipDate": "2024-07-29T15:51:28.071Z", "status": "placed", "complete": false } ``` -------------------------------- ### Successful operation response examples Source: https://docusaurus-openapi.tryingpan.dev/petstore31/place-order Example response bodies for a successful order placement in JSON and XML formats. ```json { "id": 0, "petId": 0, "quantity": 1, "shipDate": "2024-07-29T15:51:28.071Z", "status": "placed", "complete": false } ``` ```xml 0 0 1 2024-07-29T15:51:28.071Z placed false ``` -------------------------------- ### Example Search Query Construction Source: https://docusaurus-openapi.tryingpan.dev/tests/search-with-various-query-parameter-styles Demonstrates how to construct a search query URL with various parameter styles including query, array, object, and delimited arrays. ```text q = "openapi" tags = ["api", "docs"] filters = {"minPrice": 10, "maxPrice": 100} sort = ["name", "price"] fields = ["id", "name", "description"] Result: /search?q=openapi&tags=api&tags=docs&filters[minPrice]=10&filters[maxPrice]=100&sort=name%20price&fields=id|name|description ``` -------------------------------- ### POST Request Example using http.client Source: https://docusaurus-openapi.tryingpan.dev/httpbin/post-request This snippet shows how to make a POST request to httpbin.org using Python's http.client library. It demonstrates setting up the connection, sending an empty payload and headers, and reading the response. ```python import http.client conn = http.client.HTTPSConnection("httpbin.org") payload = '' headers = {} conn.request("POST", "/post", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET Request to /html Endpoint Source: https://docusaurus-openapi.tryingpan.dev/httpbin/get-html This snippet shows how to make a GET request to the /html endpoint to retrieve a simple HTML document. Ensure you have the http.client library installed. ```python import http.client conn = http.client.HTTPSConnection("httpbin.org") payload = '' headers = {} conn.request("GET", "/html", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET Request Endpoint Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-in-request-parameters-schema The base endpoint for retrieving request parameter schema examples. ```http GET ## http://test.local:8080/requestParameters/schema/examples ``` -------------------------------- ### GET /v2 Source: https://docusaurus-openapi.tryingpan.dev/petstore/find-pets-by-tags Example request to the /v2 endpoint using Python's http.client. ```APIDOC ## GET /v2 ### Description This endpoint retrieves data from the Petstore API. It requires an Authorization header with a Bearer token. ### Method GET ### Endpoint https://petstore.swagger.io/v2 ### Query Parameters - **tags** (string) - Required - Add item ### Request Example ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/v2?tags=your_tag_here", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### Response #### Success Response (200) - **Example Response Body** (object) - The structure of the response body will depend on the specific data returned by the API. ``` -------------------------------- ### GET /with-typed-additional Endpoint Example Source: https://docusaurus-openapi.tryingpan.dev/tests/object-with-typed-additional-properties This snippet demonstrates how to make a GET request to the /with-typed-additional endpoint using Python's http.client library. Ensure the 'Accept' header is set to 'application/json'. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/with-typed-additional", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/tests/get-entities-by-status Example implementation using the Python http.client library to perform a GET request. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/filter-one-status", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET /response/schema/examples Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-of-schema-in-response Retrieves a sample response object demonstrating schema structure. ```APIDOC ## GET /response/schema/examples ### Description Retrieves a sample response object demonstrating schema structure. ### Method GET ### Endpoint http://test.local:8080/response/schema/examples ### Response #### Success Response (200) - **name** (string) - The name of the individual. - **age** (number) - The age of the individual. - **isStudent** (boolean) - Indicates if the individual is a student. #### Response Example { "name": "John Doe", "age": 25, "isStudent": true } ### Request Example ```python import http.client conn = http.client.HTTPSConnection("test.local", undefined) payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/response/schema/examples", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ``` -------------------------------- ### HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/tests/get-entities-by-multiple-status Example implementation using the Python http.client library to perform the GET request. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/filter-multiple-status", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-in-request-parameters Example implementation using the http.client library to perform a GET request. ```python import http.client conn = http.client.HTTPSConnection("test.local", undefined) payload = '' headers = {} conn.request("GET", "/requestParameters/examples", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Implementation Source: https://docusaurus-openapi.tryingpan.dev/petstore31/create-users-with-array-input Example of how to perform the POST request using the Python http.client library. ```python import http.client import json conn = http.client.HTTPSConnection("petstore.swagger.io") payload = json.dumps([ { "pet": { "category": { "name": "string", "sub": { "prop1": "string" } }, "name": "Guru", "photoUrls": [ "string" ], "tags": [ { "name": "string" } ], "status": "available", "petType": { "huntingSkill": "adventurous" } }, "username": "John78", "firstName": "John", "lastName": "Smith", "email": "john.smith@example.com", "password": "drowssaP123", "phone": "+1-202-555-0192", "userStatus": 0 } ]) headers = { 'Content-Type': 'application/json' } conn.request("POST", "/v2/user/createWithArray", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/tests/all-of-inherits-parent-required Example implementation using the http.client library to perform the GET request. ```python import http.client conn = http.client.HTTPSConnection("api.example.com") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/v1/allof-parent-required", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/petstore/get-user-by-name Example of using the http.client library to perform a GET request to the API. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/v2/user/logout", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### POST /requestBody/mediaTypeObject/examples Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-of-media-type-object-in-request-body This endpoint demonstrates the use of examples for a request body with a media type object. It accepts JSON payloads and provides two example request bodies. ```APIDOC ## POST /requestBody/mediaTypeObject/examples ### Description This endpoint demonstrates the use of examples for a request body with a media type object. It accepts JSON payloads and provides two example request bodies. ### Method POST ### Endpoint http://test.local:8080/requestBody/mediaTypeObject/examples ### Parameters ### Request Body - **name** (string) - Required - The name of the person. - **age** (number) - Required - The age of the person. - **isStudent** (boolean) - Required - Indicates if the person is a student. ### Request Example #### application/json ##### example1 ```json { "name": "John Doe", "age": 25, "isStudent": true } ``` ##### example2 ```json { "name": "Jane Smith", "age": 30, "isStudent": false } ``` ### Response #### Success Response (204) No content is returned upon successful execution. #### Response Example (No content) ``` -------------------------------- ### HTTP Client Request Example Source: https://docusaurus-openapi.tryingpan.dev/tests/query-params-with-multiple-rfc-3986-reserved-chars Python implementation using http.client to perform a GET request to the reserved character endpoint. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = {} conn.request("GET", "/rfc3986/reserved", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Example Response Source: https://docusaurus-openapi.tryingpan.dev/tests/all-of-with-properties-in-array-item A sample JSON response body for the book list endpoint. ```json [ { "category": "Fiction", "id": 1234567890, "title": "The Great Gatsby", "author": "F. Scott Fitzgerald", "publishedDate": "2021-01-01", "genre": "Fiction", "tags": [ "Fiction", "Mystery" ] } ] ``` -------------------------------- ### List Buckets Python Example Source: https://docusaurus-openapi.tryingpan.dev/cos/list-buckets This Python code snippet demonstrates how to list buckets using the http.client library. Replace with your actual bearer token. ```python import http.client conn = http.client.HTTPSConnection("s3.us.cloud-object-storage.appdomain.cloud") payload = '' headers = { 'Authorization': 'Bearer ' } conn.request("GET", "/", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Fetch response using Python http.client Source: https://docusaurus-openapi.tryingpan.dev/tests/example-of-schema-properties-in-response A Python implementation using the http.client library to perform a GET request to the example endpoint. ```python import http.client conn = http.client.HTTPSConnection("test.local", undefined) payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/response/schema/properties/example", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Request Source: https://docusaurus-openapi.tryingpan.dev/tests/get-item-by-id-label-style Example of making an HTTP GET request to retrieve item data using Python's http.client library. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = {} conn.request("GET", "/items/.", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET /products Source: https://docusaurus-openapi.tryingpan.dev/restaurant/list-all-products Retrieves a list of all products available in the system. ```APIDOC ## GET /products ### Description Retrieves a list of all products. ### Method GET ### Endpoint /products ### Response #### Success Response (200) - **OK** - The request was successful. ### Request Example ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = {} conn.request("GET", "/products", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ``` -------------------------------- ### Schema Definition with Examples Array Source: https://docusaurus-openapi.tryingpan.dev/tests/schema-with-examples-array-oas-3-1 Define a schema with an `examples` array to provide multiple sample data objects. This is useful for illustrating different valid inputs for a schema. ```yaml schema: type: object properties: name: type: string age: type: integer examples: - name: "John Doe" age: 30 - name: "Jane Smith" age: 25 ``` -------------------------------- ### Python Example for Creating User List Source: https://docusaurus-openapi.tryingpan.dev/petstore_versioned/create-users-with-list-input This Python code snippet demonstrates how to send a POST request to the /v2/user/createWithList endpoint using the http.client library. Ensure the payload matches the expected JSON structure. ```python import http.client import json conn = http.client.HTTPSConnection("petstore.swagger.io") payload = json.dumps([ { "pet": { "category": { "name": "string", "sub": { "prop1": "string" } }, "name": "Guru", "photoUrls": [ "string" ], "tags": [ { "name": "string" } ], "status": "available", "petType": { "huntingSkill": "adventurous" } }, "username": "John78", "firstName": "John", "lastName": "Smith", "email": "john.smith@example.com", "password": "drowssaP123", "phone": "+1-202-555-0192", "userStatus": 0 } ]) headers = { 'Content-Type': 'application/json' } conn.request("POST", "/v2/user/createWithList", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/tests/examples-of-schema-properties-with-multiple-types-in-response This Python code uses the http.client library to make a GET request to the specified endpoint. Ensure the host and port are correctly configured. ```python import http.client conn = http.client.HTTPSConnection("test.local", undefined) payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/response/schema/properties/multipleTypes/examples", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Request Source: https://docusaurus-openapi.tryingpan.dev/tests/basic-discriminator-without-mapping Example of making a GET request to the /discriminator-basic endpoint using Python's http.client library. Ensure the server is running and accessible. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = { 'Accept': 'application/json' } conn.request("GET", "/discriminator-basic", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Python HTTP Client Example Source: https://docusaurus-openapi.tryingpan.dev/petstore31/logout-user This Python code uses the http.client library to make a GET request to the default server URL. Ensure you have the necessary network access. ```python import http.client conn = http.client.HTTPSConnection("petstore.swagger.io") payload = '' headers = {} conn.request("GET", "/v2", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### GET /requestParameters/example Source: https://docusaurus-openapi.tryingpan.dev/tests/example-in-request-parameters This endpoint demonstrates the usage of query parameters. It accepts 'name', 'age', and 'isStudent' as query parameters. ```APIDOC ## GET /requestParameters/example ### Description This endpoint demonstrates the usage of query parameters. It accepts 'name', 'age', and 'isStudent' as query parameters. ### Method GET ### Endpoint http://test.local:8080/requestParameters/example ### Parameters #### Query Parameters - **name** (string) - Required - name example - **age** (number) - Required - age example - **isStudent** (boolean | null) - Required - isStudent example ### Response #### Success Response (204) no content ### Request Example ```json { "example": "request body" } ``` ### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Python HTTP Client Redirect Example Source: https://docusaurus-openapi.tryingpan.dev/httpbin/get-redirect-to Uses Python's http.client to make a GET request to the /redirect-to endpoint. Ensure the 'url' parameter is provided in the actual request. ```python import http.client conn = http.client.HTTPSConnection("httpbin.org") payload = '' headers = {} conn.request("GET", "/redirect-to", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### List All Products using Python http.client Source: https://docusaurus-openapi.tryingpan.dev/restaurant/list-all-products Use this snippet to list all products from the Docusaurus OpenAPI. Requires Python's http.client library. ```python import http.client conn = http.client.HTTPSConnection("docusaurus-openapi.tryingpan.dev") payload = '' headers = {} conn.request("GET", "/products", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ```