Skip to content

Instantly share code, notes, and snippets.

@sankalpk
Created March 20, 2023 21:40
Show Gist options
  • Save sankalpk/b5ae7cb6e48d352051a1c3e40344d1c8 to your computer and use it in GitHub Desktop.
Save sankalpk/b5ae7cb6e48d352051a1c3e40344d1c8 to your computer and use it in GitHub Desktop.
OpenAPI
{
"openapi": "3.0.0",
"servers": [
{
"url": "https://gist.githubusercontent.com/"
}
],
"info": {
"title": "alias OpenAPI",
"description": "A place to get currency for things",
"version": "1.0.1"
},
"tags": [
{
"name": "TestAPI"
},
{
"name": "ProductCatalogAPI"
},
{
"name": "PricingInsightsAPI"
}
],
"paths": {
"/api/v1/catalog": {
"get": {
"description": "Search catalog",
"operationId": "ProductCatalogAPI_SearchCatalog",
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/v1SearchCatalogResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/rpcStatus"
}
}
}
}
},
"parameters": [
{
"name": "query",
"description": "The term to search.",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "limit",
"description": "The items of each page. Default value is N.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"format": "int64"
}
},
{
"name": "paginationToken",
"description": "Pass the next_pagination_token you got from the last request. Default value is empty.",
"in": "query",
"required": false,
"schema": {
"type": "string"
}
}
],
"tags": [
"Catalog"
]
}
},
"/api/v1/catalog/{id}": {
"get": {
"description": "Get catalog item",
"operationId": "ProductCatalogAPI_GetCatalogItem",
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/v1GetCatalogItemResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/rpcStatus"
}
}
}
}
},
"parameters": [
{
"name": "id",
"description": "The item to get.",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"tags": [
"Catalog"
]
}
},
"/api/v1/pricing_insights/availability": {
"get": {
"description": "Gets common marketplace data for the provided catalog item.",
"operationId": "PricingInsightsAPI_GetAvailability",
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/v1GetAvailabilityResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/rpcStatus"
}
}
}
}
},
"parameters": [
{
"name": "catalogId",
"description": "The catalog id.",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "size",
"description": "The requested size. Empty values are all sizes.",
"in": "query",
"required": false,
"schema": {
"type": "number",
"format": "double"
}
},
{
"name": "productCondition",
"description": "The requested product condition. Empty values are all.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"PRODUCT_CONDITION_INVALID",
"PRODUCT_CONDITION_NEW",
"PRODUCT_CONDITION_USED",
"PRODUCT_CONDITION_NEW_WITH_DEFECTS"
],
"default": "PRODUCT_CONDITION_INVALID"
}
},
{
"name": "packagingCondition",
"description": "The requested packaging condition. Empty values are all.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"PACKAGING_CONDITION_INVALID",
"PACKAGING_CONDITION_GOOD_CONDITION",
"PACKAGING_CONDITION_MISSING_LID",
"PACKAGING_CONDITION_BADLY_DAMAGED",
"PACKAGING_CONDITION_NO_ORIGINAL_BOX"
],
"default": "PACKAGING_CONDITION_INVALID"
}
},
{
"name": "consigned",
"description": "Whether the item is consigned or not. Empty values are both.",
"in": "query",
"required": false,
"schema": {
"type": "boolean"
}
},
{
"name": "regionId",
"description": "The region given. Empty values represent all regions (global).",
"in": "query",
"required": false,
"schema": {
"type": "string",
"format": "int64"
}
}
],
"tags": [
"Pricing Insights"
]
}
},
"/api/v1/pricing_insights/offer_histogram": {
"get": {
"description": "Gets the histogram and bucketed offerings.",
"operationId": "PricingInsightsAPI_GetOfferHistogram",
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/v1GetOfferHistogramResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/rpcStatus"
}
}
}
}
},
"parameters": [
{
"name": "catalogId",
"description": "The catalog id.",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "size",
"description": "The requested size. Empty values are all sizes.",
"in": "query",
"required": false,
"schema": {
"type": "number",
"format": "double"
}
},
{
"name": "productCondition",
"description": "The requested product condition. Empty values are all.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"PRODUCT_CONDITION_INVALID",
"PRODUCT_CONDITION_NEW",
"PRODUCT_CONDITION_USED",
"PRODUCT_CONDITION_NEW_WITH_DEFECTS"
],
"default": "PRODUCT_CONDITION_INVALID"
}
},
{
"name": "packagingCondition",
"description": "The requested packaging condition. Empty values are all.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"PACKAGING_CONDITION_INVALID",
"PACKAGING_CONDITION_GOOD_CONDITION",
"PACKAGING_CONDITION_MISSING_LID",
"PACKAGING_CONDITION_BADLY_DAMAGED",
"PACKAGING_CONDITION_NO_ORIGINAL_BOX"
],
"default": "PACKAGING_CONDITION_INVALID"
}
},
{
"name": "regionId",
"description": "The region given. Empty values are considered global.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"format": "int64"
}
}
],
"tags": [
"Pricing Insights"
]
}
},
"/api/v1/pricing_insights/sold_products": {
"get": {
"description": "Query sold products and filter by attributes",
"operationId": "PricingInsightsAPI_ListSoldProducts",
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/v1ListSoldProductsResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/rpcStatus"
}
}
}
}
},
"parameters": [
{
"name": "catalogId",
"description": "The unique id that identifies the product in our catalog.",
"in": "query",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "size",
"description": "The size of the product represented as a double. Options can be fetched via another API. For shoes, it is often the US size.",
"in": "query",
"required": false,
"schema": {
"type": "number",
"format": "double"
}
},
{
"name": "limit",
"description": "The max number of sold products to return. Otherwise, defaults to 10.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"format": "int64"
}
},
{
"name": "productCondition",
"description": "An enum describing the condition of the sold product.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"PRODUCT_CONDITION_INVALID",
"PRODUCT_CONDITION_NEW",
"PRODUCT_CONDITION_USED",
"PRODUCT_CONDITION_NEW_WITH_DEFECTS"
],
"default": "PRODUCT_CONDITION_INVALID"
}
},
{
"name": "packagingCondition",
"description": "An enum describing the packaging of the sold product.",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"PACKAGING_CONDITION_INVALID",
"PACKAGING_CONDITION_GOOD_CONDITION",
"PACKAGING_CONDITION_MISSING_LID",
"PACKAGING_CONDITION_BADLY_DAMAGED",
"PACKAGING_CONDITION_NO_ORIGINAL_BOX"
],
"default": "PACKAGING_CONDITION_INVALID"
}
},
{
"name": "consigned",
"description": "A boolean indicating whether the product was consigned.",
"in": "query",
"required": false,
"schema": {
"type": "boolean"
}
},
{
"name": "regionId",
"description": "The region in which the products were sold. Defaults to global if none specified.",
"in": "query",
"required": false,
"schema": {
"type": "string"
}
}
],
"tags": [
"Pricing Insights"
]
}
},
"/api/v1/test": {
"get": {
"description": "This is a test endpoint that is meant to confirm that your token is valid",
"operationId": "TestAPI_Test",
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/v1TestResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/rpcStatus"
}
}
}
}
},
"tags": [
"TestAPI"
]
}
}
},
"components": {
"schemas": {
"OfferHistogramOfferHistogramBin": {
"type": "object",
"properties": {
"offerPriceCents": {
"type": "string",
"format": "int64",
"description": "The price of the given bin."
},
"count": {
"type": "string",
"format": "int64",
"description": "The count of offers under the given bin price."
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/components/schemas/protobufAny"
}
}
}
},
"v1Availability": {
"type": "object",
"properties": {
"lowestListingPriceCents": {
"type": "string",
"format": "int64",
"description": "The lowest listing price for the given parameters."
},
"highestOfferPriceCents": {
"type": "string",
"format": "int64",
"description": "The highest offer price for the given parameters."
},
"lastSoldListingPriceCents": {
"type": "string",
"format": "int64",
"description": "The last sold price cents for given parameters."
},
"globalIndicatorPriceCents": {
"type": "string",
"format": "int64",
"description": "The global indicator price cents."
}
}
},
"v1CatalogItem": {
"type": "object",
"properties": {
"catalogId": {
"type": "string",
"description": "The catalog id."
},
"name": {
"type": "string",
"description": "The name of the catalog."
},
"sku": {
"type": "string",
"description": "The SKU."
},
"brand": {
"type": "string",
"description": "The brand name."
}
}
},
"v1GetAvailabilityResponse": {
"type": "object",
"properties": {
"availability": {
"$ref": "#/components/schemas/v1Availability",
"description": "The availability information for the given variation"
}
}
},
"v1GetCatalogItemResponse": {
"type": "object",
"properties": {
"catalogItem": {
"$ref": "#/components/schemas/v1CatalogItem",
"description": "The catalog item."
}
}
},
"v1GetOfferHistogramResponse": {
"type": "object",
"properties": {
"offerHistogram": {
"$ref": "#/components/schemas/v1OfferHistogram",
"description": "The offer histogram."
}
}
},
"v1ListSoldProductsResponse": {
"type": "object",
"properties": {
"soldProducts": {
"type": "array",
"items": {
"$ref": "#/components/schemas/v1SoldProduct"
}
}
},
"description": "Created when a customer buys a product",
"title": "Purchase"
},
"v1OfferHistogram": {
"type": "object",
"properties": {
"bins": {
"type": "array",
"items": {
"$ref": "#/components/schemas/OfferHistogramOfferHistogramBin"
},
"description": "The list of offer histogram items, sorted from highest to lowest."
}
}
},
"v1PackagingCondition": {
"type": "string",
"enum": [
"PACKAGING_CONDITION_INVALID",
"PACKAGING_CONDITION_GOOD_CONDITION",
"PACKAGING_CONDITION_MISSING_LID",
"PACKAGING_CONDITION_BADLY_DAMAGED",
"PACKAGING_CONDITION_NO_ORIGINAL_BOX"
],
"default": "PACKAGING_CONDITION_INVALID"
},
"v1ProductCondition": {
"type": "string",
"enum": [
"PRODUCT_CONDITION_INVALID",
"PRODUCT_CONDITION_NEW",
"PRODUCT_CONDITION_USED",
"PRODUCT_CONDITION_NEW_WITH_DEFECTS"
],
"default": "PRODUCT_CONDITION_INVALID"
},
"v1SearchCatalogResponse": {
"type": "object",
"properties": {
"catalogItems": {
"type": "array",
"items": {
"$ref": "#/components/schemas/v1CatalogItem"
},
"description": "The Catalog items."
},
"nextPaginationToken": {
"type": "string",
"description": "Scroll to next page by this token"
},
"hasMore": {
"type": "boolean",
"description": "Has more items."
}
}
},
"v1SoldProduct": {
"type": "object",
"properties": {
"purchasedAt": {
"type": "string",
"format": "date-time",
"description": "The timestamp at which the product was sold. Represents UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."
},
"priceCents": {
"type": "string",
"format": "int64",
"description": "The price in USD cents at which the product sold."
},
"size": {
"type": "number",
"format": "double",
"description": "The size of the product represented as a double. Options can be fetched via another API. For shoes, it is often the US size."
},
"consigned": {
"type": "boolean",
"description": "A boolean indicating whether the product was consigned."
},
"catalogId": {
"type": "string",
"description": "The unique id that identifies the product in our catalog."
}
},
"description": "Created when a customer purchases a product.",
"title": "Sold Product"
},
"v1TestResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"description": "Should be set to true if the request succeeded."
}
},
"description": "A test response message. Should be { ok: true }",
"title": "Test Response"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment