{
  "openapi": "3.0.3",
  "info": {
    "title": "二维码生成和识别",
    "description": "为用户提供在线二维码生成器及其识别功能，其中二维码识别支持Base64、上传图片及复制图片地址识别等方式。广泛应用于宣传海报、简历、餐桌牌同步点餐、二维码上网、产品溯源及扫码支付等应用场景。",
    "termsOfService": "https://www.showapi.com/helpcenter/view#/4019/2",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://route.showapi.com"
    }
  ],
  "paths": {
    "/887-4": {
      "x-pointCode": 4,
      "x-mode": "mapping",
      "x-read-timeout": 30,
      "x-connect-timeout": 30,
      "post": {
        "summary": "二维码识别(Base64)",
        "description": "根据图片的Base64信息,识别图片中的信息",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "string",
                              "description": "错误编码:0为成功 其他值为失败"
                            },
                            "retText": {
                              "type": "string",
                              "description": "返回值"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "887_4_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "imgData": {
                    "type": "string",
                    "minLength": 0,
                    "maxLength": 10000000,
                    "description": "图片的base64信息"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/887-3": {
      "x-pointCode": 3,
      "x-mode": "mapping",
      "x-read-timeout": 40,
      "x-connect-timeout": 30,
      "post": {
        "summary": "二维码识别(图片地址)",
        "description": "根据图片的链接地址来识别二维码",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "string",
                              "description": "业务请求是否成功"
                            },
                            "flag": {
                              "type": "string",
                              "description": "图片识别是否成功"
                            },
                            "msg": {
                              "type": "string",
                              "description": "操作信息"
                            },
                            "retText": {
                              "type": "string",
                              "description": "图片识别后的信息"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "887_3_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "imgUrl": {
                    "type": "string",
                    "description": "二维码图片的链接地址"
                  }
                },
                "required": [
                  "imgUrl"
                ]
              }
            }
          }
        }
      }
    },
    "/887-2": {
      "x-pointCode": 2,
      "x-mode": "mapping",
      "x-read-timeout": 30,
      "x-connect-timeout": 30,
      "post": {
        "summary": "二维码识别(图片上传)",
        "description": "上传二维码图片,识别后返回识别的信息",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "string",
                              "description": "业务请求是否成功"
                            },
                            "flag": {
                              "type": "string",
                              "description": "图片识别是否成功"
                            },
                            "msg": {
                              "type": "string",
                              "description": "操作信息"
                            },
                            "retText": {
                              "type": "string",
                              "description": "识别后返回的信息"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "887_2_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "img": {
                    "type": "string",
                    "format": "binary",
                    "description": "二维码图片信息(图片最大为100KB)"
                  }
                },
                "required": [
                  "img"
                ]
              }
            }
          }
        }
      }
    },
    "/887-1": {
      "x-pointCode": 1,
      "x-mode": "mapping",
      "x-read-timeout": 10,
      "x-connect-timeout": 10,
      "post": {
        "summary": "二维码生成",
        "description": "生成二维码图片 图片存放在showapi服务器上,会不定期的清理,请及时拷贝!，若需要在二维码中嵌入图片，可以使用 【二维码-专业版】 接口",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "string",
                              "description": "业务是否请求成功"
                            },
                            "flag": {
                              "type": "string",
                              "description": "二维码生成是否成功"
                            },
                            "msg": {
                              "type": "string",
                              "description": "提示信息"
                            },
                            "imgUrl": {
                              "type": "string",
                              "description": "二维码图片的地址"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "887_1_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "需要生成二维码的内容"
                  },
                  "size": {
                    "type": "string",
                    "description": "图片大小 整数类型:1-10 ,1最小，10最大，值为偶数时生成的二维码边框会比奇数时大一点，content内容较多建议使用小于5的值，content内容较少建议使用大于6的值，二维码图片宽度大约等于content的字节数*size的值，若content实在太少，比如content内容只有1个字节，我们还提供了16，20，30这三个大号size。"
                  },
                  "imgExtName": {
                    "type": "string",
                    "description": "图片格式:jpeg,jpg,png或者gif"
                  }
                },
                "required": [
                  "content"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AppKeyAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "appKey",
        "description": "从 ShowAPI 控制台获取的 appKey，管理地址：https://www.showapi.com/console#/myApp"
      }
    },
    "schemas": {
      "ShowapiResEnvelope": {
        "type": "object",
        "description": "ShowAPI 统一返回包裹（业务数据位于 showapi_res_body）",
        "properties": {
          "showapi_res_code": {
            "type": "integer",
            "description": "API 返回的状态码"
          },
          "showapi_res_error": {
            "type": "string",
            "description": "API 返回的错误信息"
          },
          "showapi_res_id": {
            "type": "string",
            "description": "API 请求的唯一标识"
          },
          "showapi_fee_num": {
            "type": "integer",
            "description": "API 调用计费次数"
          }
        }
      }
    }
  },
  "security": [
    {
      "AppKeyAuth": []
    }
  ],
  "externalDocs": {
    "url": "https://www.showapi.com/apiGateway/view/887?tab=book"
  },
  "x-apiCode": "887",
  "x-is-own": false,
  "x-is-op": true
}