I'd like to access huge data located in external system from my AppSheet app so now trying to use OpenAPI integration. I don't want to build an Apigee instance which is quite expensive just for this use case, so I simply created a public REST API on Cloud Run and served OpenAPI spec on (https://{hostname}/apispec.yaml) and added it as an Apigee API connection. It worked well as I expected.
openapi: 3.0.3
info:
description: API for managing Products.
version: 0.0.1
title: Products API
servers:
- url: https://openapi-sample-xxxx.a.run.app/
security:
- ApiKeyAuth: []
paths:
/products:
get:
summary: List 'Products' objects.
description: Retrieve a page of 'Product' objects from the server.
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Product'
post:
...(omit)...
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
name: x-apikey
in: header
schemas:
Product:
title: Product
type: object
properties:
created_at:
type: string
department_name:
type: string
id:
type: string
image:
type: string
jan:
type: string
list_price:
type: integer
Next, as the number of records are so huge, I need to support pagination. So I implemented limit&offset based pagination on GET /products endpoint, and added the x-pagination section to the yaml following the official doc.
After that I tried to add the integration information on AppSheet console, but when I press validate button, it showed the following error:
Error
Not connected. Invalid OpenAPI Spec: Apigee: Invalid pagination
Does anyone has any advice? The current yaml which causes error is the following:
openapi: 3.0.3
info:
description: API for managing Products.
version: 0.0.1
title: Products API
servers:
- url: https://openapi-sample-xxxx.a.run.app/
security:
- ApiKeyAuth: []
paths:
/products:
get:
summary: List 'Products' objects.
description: Retrieve a page of 'Product' objects from the server.
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Product'
x-pagination:
type: offset
limitParam: limit
defaulLimit: 100
offsetParam: offset
defaultOffset: 0
post:
...(omit)...
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
name: x-apikey
in: header
schemas:
Product:
title: Product
type: object
properties:
created_at:
type: string
department_name:
type: string
id:
type: string
image:
type: string
jan:
type: string
list_price:
type: integer
User | Count |
---|---|
35 | |
30 | |
30 | |
20 | |
18 |