Skip to content

Instantly share code, notes, and snippets.

@bbooth
Created October 27, 2021 19:24
Show Gist options
  • Save bbooth/6ed4ccf9a1cc333d062bac327442d9e5 to your computer and use it in GitHub Desktop.
Save bbooth/6ed4ccf9a1cc333d062bac327442d9e5 to your computer and use it in GitHub Desktop.
Content Publishing API Spec
openapi: "3.0.0"
info:
description: "This is a sample content publishing api."
version: "1.0.0"
title: "Content Publishing"
tags:
- name: "publishing"
description: "Endpoints to support content publishing"
servers:
- url: https://{service_name}.keapapis.com:{port}/v1
variables:
service_name:
default: template-mgmt-service
description: Kubernetes service name
port:
enum:
- '8080'
default: '8080'
paths:
/publishing/{resource_type}/{resource_id}/dependencies:
get:
tags:
- "publishing"
summary: "Get a resource's dependencies"
description: "This endpoint will return a list of it's external dependencies. Example: a landing page might have references to custom fields."
operationId: "getResourceDependencies"
parameters:
- name: "page_token"
in: "query"
description: "The page token to start the the results at"
required: false
schema:
type: "string"
example: "YXNkZmVyZ2tqbmxrYXNiZGZhd2Vm"
- name: "page_size"
in: "query"
description: "The page size"
required: false
schema:
type: "integer"
format: "int32"
default: 100
- name: "resource_type"
in: "path"
description: "Resource type"
required: true
schema:
type: "string"
example: "unlayer_template"
- name: "resource_id"
in: "path"
description: "The id of the resource"
required: true
schema:
type: "string"
example: "ee72ae66-627f-499f-b52e-1a1b79f3bb9e"
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
$ref: "#/components/schemas/DependencyResponse"
"400":
description: "Invalid input"
content:
application/json":
schema:
$ref: "#/components/schemas/ErrorResponse"
"5XX":
description: "Server Error"
content:
application/json":
schema:
$ref: "#/components/schemas/ErrorResponse"
security:
- BearerAuth: []
/publishing/{resourceType}/{resourceId}:clone:
post:
tags:
- "publishing"
summary: "Clone a resource"
description: "Clone a resource to a new tenant"
operationId: "cloneResource"
parameters:
- name: "resourceType"
in: "path"
description: "Resource type"
required: true
schema:
type: "string"
- name: "resourceId"
in: "path"
description: "Resource id"
required: true
schema:
type: "string"
requestBody:
description: "The array of mapped resources that have already been cloned"
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CloningRequest"
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
$ref: "#/components/schemas/CloningResponse"
"400":
description: "Invalid status value"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"5XX":
description: "Server Error"
content:
application/json":
schema:
$ref: "#/components/schemas/ErrorResponse"
security:
- BearerAuth: []
components:
securitySchemes:
BearerAuth:
type: "http"
scheme: "bearer"
schemas:
DependencyResponse:
type: "object"
properties:
dependencies:
type: "array"
items:
properties:
id:
type: "string"
example: "Custom_Shoe_Size"
resource_type:
type: "string"
example: "custom_field"
source_tenant:
type: "string"
example: "abc123"
required:
- "id"
- "resource_type"
next_page_token:
type: "string"
example: "YXNkZmVyZ2tqbmxrYXNiZGZhd2Vm"
description: "If there are additional pages of data then you will receive a next page token to use in your subsequent request"
CloningRequest:
type: "object"
properties:
tenant:
type: "string"
dependencies:
type: "array"
items:
properties:
resource_type:
type: "string"
resource_id:
type: "string"
cloned_resource_id:
type: "string"
required:
- "resource_type"
- "resource_id"
- "cloned_resource_id"
CloningResponse:
type: "object"
properties:
resource_type:
type: "string"
resource_id:
type: "string"
cloned_resource_id:
type: "string"
ErrorResponse:
type: "object"
properties:
error:
type: "object"
properties:
code:
type: "integer"
example: 400
message:
type: "string"
example: "Invalid tenant"
status:
type: "string"
enum: ["ABORTED", "ALREADY_EXISTS", "CANCELLED", "DATA_LOSS", "DEADLINE_EXCEEDED", " FAILED_PRECONDITION", "INTERNAL", "INVALID_ARGUMENT", "NOT_FOUND", "OK", "OUT_OF_RANGE", "PERMISSION_DENIED", "RESOURCE_EXHAUSTED", "UNAUTHENTICATED", "UNAVAILABLE", "UNIMPLEMENTED", "UNKNOWN"]
example: "INVALID_ARGUMENT"
details:
type: "array"
items:
type: "object"
security:
- BearerAuth: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment