0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

The Cat API と Swagger.json とカスタム コネクタ

Posted at

The Cat API

お試しにちょうどいいのでたまに使う。

Swagger.json

その Swagger.json を作りたかったので作ったもの。

{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "The Cat API",
    "description": "An API for accessing cat images and data"
  },
  "host": "api.thecatapi.com",
  "basePath": "/v1",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/images/search": {
      "get": {
        "summary": "Search cat images",
        "description": "Returns a list of cat images based on search criteria",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of results to return",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "description": "The page number of results to return",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "breed_id",
            "in": "query",
            "description": "The ID of the breed to search for",
            "required": false,
            "type": "string"
          },
          {
            "name": "size",
            "in": "query",
            "description": "The size of the image to return (full or medium)",
            "required": false,
            "type": "string",
            "enum": [
              "full",
              "medium"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Image"
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Image": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The ID of the image"
        },
        "url": {
          "type": "string",
          "description": "The URL of the image"
        },
        "breeds": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Breed"
          },
          "description": "The list of breeds associated with the image"
        }
      }
    },
    "Breed": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The ID of the breed"
        },
        "name": {
          "type": "string",
          "description": "The name of the breed"
        },
        "description": {
          "type": "string",
          "description": "The description of the breed"
        }
      }
    }
  }
}

Swagger のためのツール

あと Chat GPT。

カスタム コネクタ

image.png

完成

image.png

image.png

image.png

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?