Skip to content

Instantly share code, notes, and snippets.

@thees
Created April 23, 2020 09:51
Show Gist options
  • Save thees/9f45b391e1996a619845cd53b38e1d4a to your computer and use it in GitHub Desktop.
Save thees/9f45b391e1996a619845cd53b38e1d4a to your computer and use it in GitHub Desktop.
ausschnitt aus CT api zum testen
swagger: '2.0'
info:
title: Commercetools
version: v1
host: api.europe-west1.gcp.commercetools.com
schemes:
- https
consumes:
- application/json
produces:
- application/json
securityDefinitions:
oauth_2_0:
description: |
HTTP API authorization uses [OAuth2](http://tools.ietf.org/html/rfc6750).
Clients must obtain an access token from the auth service using one of
the authorization flows described below, before they are able to make authorized requests
to other commercetools services. On successful completion of an authorization flow,
a client will be given an `access_token`, which they need to include in requests
to authorized service endpoints via the HTTP `Authorization` header like this:
type: oauth2
flow: application
tokenUrl: 'https://auth.europe-west1.gcp.commercetools.com/oauth/token'
scopes:
'manage_project:{projectKey}': ''
'manage_products:{projectKey}': ''
'view_products:{projectKey}': ''
'manage_orders:{projectKey}': ''
'manage_orders:{projectKey}:{storeKey}': ''
'view_orders:{projectKey}': ''
'view_orders:{projectKey}:{storeKey}': ''
'manage_customers:{projectKey}': ''
'view_customers:{projectKey}': ''
'manage_payments:{projectKey}': ''
'view_payments:{projectKey}': ''
'manage_subscriptions:{projectKey}': ''
'manage_extensions:{projectKey}': ''
'manage_types:{projectKey}': ''
'view_types:{projectKey}': ''
'view_shopping_lists:{projectKey}': ''
'manage_shopping_lists:{projectKey}': ''
'manage_my_orders:{projectKey}': ''
'manage_my_orders:{projectKey}:{storeKey}': ''
'manage_my_profile:{projectKey}': ''
'view_project_settings:{projectKey}': ''
'view_published_products:{projectKey}': ''
'manage_cart_discounts:{projectKey}': ''
'view_cart_discounts:{projectKey}': ''
'manage_customer_groups:{projectKey}': ''
'view_customer_groups:{projectKey}': ''
'view_shipping_methods:{projectKey}': ''
'manage_shipping_methods:{projectKey}': ''
'manage_tax_categories:{projectKey}': ''
'view_tax_categories:{projectKey}': ''
'manage_categories:{projectKey}': ''
'view_categories:{projectKey}': ''
definitions:
TypeUpdate:
title: TypeUpdate
type: object
properties:
version:
format: int64
type: number
actions:
type: array
items:
"$ref": "#/definitions/TypeUpdateAction"
required:
- version
- actions
x-annotation-package: Type
TypeUpdateAction:
title: TypeUpdateAction
discriminator: action
type: object
properties:
action:
type: string
required:
- action
x-annotation-package: Type
TermFacetResult:
title: TermFacetResult
allOf:
- $ref: '#/definitions/FacetResult'
- properties:
dataType:
$ref: '#/definitions/TermFacetResultType'
missing:
format: int64
type: number
total:
format: int64
type: number
other:
format: int64
type: number
terms:
type: array
items:
$ref: '#/definitions/FacetResultTerm'
required:
- dataType
- missing
- total
- other
- terms
type: object
x-annotation-package: Product
LastModifiedBy:
title: LastModifiedBy
$ref: '#/definitions/ClientLogging'
x-annotation-package: Common
ClientLogging:
title: ClientLogging
type: object
properties:
clientId:
type: string
externalUserId:
type: string
customer:
$ref: '#/definitions/CustomerReference'
anonymousId:
type: string
x-annotation-package: Common
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-types#client-logging'
CountryCode:
title: CountryCode
pattern: '^[A-Z]{2}$'
description: |
A two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
type: string
x-annotation-package: Common
CreatedBy:
title: CreatedBy
$ref: '#/definitions/ClientLogging'
x-annotation-package: Common
Address:
title: Address
type: object
properties:
id:
type: string
key:
type: string
title:
type: string
salutation:
type: string
firstName:
type: string
lastName:
type: string
streetName:
type: string
streetNumber:
type: string
additionalStreetInfo:
type: string
postalCode:
type: string
city:
type: string
region:
type: string
state:
type: string
country:
$ref: '#/definitions/CountryCode'
company:
type: string
department:
type: string
building:
type: string
apartment:
type: string
pOBox:
type: string
phone:
type: string
mobile:
type: string
email:
type: string
fax:
type: string
additionalAddressInfo:
type: string
externalId:
type: string
required:
- country
x-annotation-package: Common
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-types.html#address'
Customer:
title: Customer
allOf:
- $ref: '#/definitions/BaseResource'
- properties:
id:
description: The unique ID of the customer.
type: string
x-annotation-identifier: true
version:
format: int64
description: The current version of the customer.
type: number
createdAt:
type: string
format: date-time
lastModifiedAt:
type: string
format: date-time
lastModifiedBy:
description: Present on resources updated after 1/02/2019 except for events not tracked.
$ref: '#/definitions/LastModifiedBy'
createdBy:
description: Present on resources created after 1/02/2019 except for events not tracked.
$ref: '#/definitions/CreatedBy'
customerNumber:
description: |-
The customer number can be used to create a more human-readable (in contrast to ID) identifier for the customer.
It should be unique across a project.
Once the field was set it cannot be changed anymore.
type: string
email:
description: |-
The customer's email address and the main identifier of uniqueness for a customer account.
Email addresses are either unique to the store they're specified for, _or_ for the entire project.
For more information, see Email uniquenes.
type: string
password:
type: string
firstName:
type: string
lastName:
type: string
middleName:
type: string
title:
type: string
dateOfBirth:
type: string
format: date
companyName:
type: string
vatId:
type: string
addresses:
description: The addresses have unique IDs in the addresses list
type: array
items:
$ref: '#/definitions/Address'
defaultShippingAddressId:
description: The address ID in the addresses list
type: string
shippingAddressIds:
description: The IDs from the addresses list which are used as shipping addresses
type: array
items:
type: string
defaultBillingAddressId:
description: The address ID in the addresses list
type: string
billingAddressIds:
description: The IDs from the addresses list which are used as billing addresses
type: array
items:
type: string
isEmailVerified:
type: boolean
externalId:
type: string
locale:
type: string
salutation:
type: string
key:
description: |-
User-specific unique identifier for a customer.
Must be unique across a project.
The field can be reset using the Set Key UpdateAction
type: string
required:
- id
- version
- createdAt
- lastModifiedAt
- email
- password
- addresses
- isEmailVerified
type: object
x-annotation-package: Customer
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-customers.html#customer'
x-annotation-updateType: CustomerUpdate
ReferenceTypeId:
title: ReferenceTypeId
enum:
- cart
- cart-discount
- category
- channel
- customer
- customer-group
- discount-code
- key-value-document
- payment
- product
- product-type
- product-discount
- order
- review
- shopping-list
- shipping-method
- state
- store
- tax-category
- type
- zone
- inventory-entry
- order-edit
type: string
x-annotation-package: Common
Reference:
title: Reference
discriminator: typeId
type: object
properties:
typeId:
$ref: '#/definitions/ReferenceTypeId'
id:
type: string
required:
- typeId
- id
x-annotation-package: Common
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-types.html#reference'
CustomerReference:
title: CustomerReference
allOf:
- $ref: '#/definitions/Reference'
- properties:
obj:
$ref: '#/definitions/Customer'
type: object
x-annotation-package: Customer
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-customers.html#customer'
FacetResultTerm:
title: FacetResultTerm
type: object
properties:
term:
type: string
count:
format: int64
type: number
productCount:
format: int64
type: number
required:
- term
- count
x-annotation-package: Product
TermFacetResultType:
title: TermFacetResultType
enum:
- text
- date
- time
- datetime
- boolean
- number
type: string
x-annotation-package: Product
FacetResultRange:
title: FacetResultRange
type: object
properties:
from:
type: number
fromStr:
type: string
to:
type: number
toStr:
type: string
count:
format: int64
type: number
productCount:
format: int64
type: number
total:
format: int64
type: number
min:
type: number
max:
type: number
mean:
type: number
required:
- from
- fromStr
- to
- toStr
- count
- total
- min
- max
- mean
x-annotation-package: Product
RangeFacetResult:
title: RangeFacetResult
allOf:
- $ref: '#/definitions/FacetResult'
- properties:
ranges:
type: array
items:
$ref: '#/definitions/FacetResultRange'
required:
- ranges
type: object
x-annotation-package: Product
FilteredFacetResult:
title: FilteredFacetResult
allOf:
- $ref: '#/definitions/FacetResult'
- properties:
count:
format: int64
type: number
productCount:
format: int64
type: number
required:
- count
type: object
x-annotation-package: Product
FacetResults:
title: FacetResults
type: object
additionalProperties:
oneOf:
- $ref: '#/definitions/FacetResult'
- $ref: '#/definitions/FilteredFacetResult'
- $ref: '#/definitions/RangeFacetResult'
- $ref: '#/definitions/TermFacetResult'
x-annotation-package: Product
FacetResult:
title: FacetResult
discriminator: type
type: object
properties:
type:
$ref: '#/definitions/FacetTypes'
required:
- type
x-annotation-package: Product
FacetTypes:
title: FacetTypes
enum:
- terms
- range
- filter
type: string
x-annotation-package: Product
BaseResource:
title: BaseResource
type: object
properties:
id:
type: string
x-annotation-identifier: true
version:
format: int64
type: number
createdAt:
type: string
format: date-time
lastModifiedAt:
type: string
format: date-time
required:
- id
- version
- createdAt
- lastModifiedAt
x-annotation-package: Common
x-annotation-abstract: true
PagedQueryResponse:
title: PagedQueryResponse
type: object
properties:
limit:
format: int64
type: number
count:
format: int64
type: number
total:
format: int64
type: number
offset:
format: int64
type: number
results:
type: array
items:
$ref: '#/definitions/BaseResource'
facets:
$ref: '#/definitions/FacetResults'
meta:
type: object
required:
- limit
- count
- offset
- results
x-annotation-package: Common
Update:
title: Update
type: object
properties:
version:
format: int64
type: number
actions:
type: array
items:
$ref: '#/definitions/UpdateAction'
required:
- version
- actions
x-annotation-package: Common
UpdateAction:
title: UpdateAction
type: object
properties:
action:
type: string
required:
- action
x-annotation-package: Common
Zone:
title: Zone
allOf:
- $ref: '#/definitions/BaseResource'
- properties:
id:
description: The unique ID of the zone.
type: string
x-annotation-identifier: true
version:
format: int64
description: The current version of the zone.
type: number
createdAt:
type: string
format: date-time
lastModifiedAt:
type: string
format: date-time
lastModifiedBy:
$ref: '#/definitions/LastModifiedBy'
createdBy:
$ref: '#/definitions/CreatedBy'
key:
description: |-
User-specific unique identifier for a zone.
Must be unique across a project.
The field can be reset using the Set Key UpdateAction.
type: string
name:
type: string
description:
type: string
required:
- id
- version
- createdAt
- lastModifiedAt
- name
- locations
type: object
x-annotation-package: Zone
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-zones.html#zone'
x-annotation-updateType: ZoneUpdate
ZoneDraft:
title: ZoneDraft
type: object
properties:
key:
description: |-
User-specific unique identifier for a zone.
Must be unique across a project.
The field can be reset using the Set Key UpdateAction.
type: string
name:
type: string
description:
type: string
required:
- name
- locations
x-annotation-package: Zone
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-zones.html#zonedraft'
ZonePagedQueryResponse:
title: ZonePagedQueryResponse
type: object
properties:
limit:
format: int64
type: number
count:
format: int64
type: number
total:
format: int64
type: number
offset:
format: int64
type: number
results:
type: array
items:
$ref: '#/definitions/Zone'
required:
- limit
- count
- offset
- results
x-annotation-package: Zone
ZoneReference:
title: ZoneReference
allOf:
- $ref: '#/definitions/Reference'
- properties:
obj:
$ref: '#/definitions/Zone'
type: object
x-annotation-package: Zone
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-zones.html#zone'
ZoneUpdate:
title: ZoneUpdate
type: object
properties:
version:
format: int64
type: number
actions:
type: array
items:
$ref: '#/definitions/ZoneUpdateAction'
required:
- version
- actions
x-annotation-package: Zone
ZoneUpdateAction:
title: ZoneUpdateAction
discriminator: action
type: object
properties:
action:
type: string
required:
- action
x-annotation-package: Zone
ZoneChangeNameAction:
title: ZoneChangeNameAction
allOf:
- $ref: '#/definitions/ZoneUpdateAction'
- properties:
name:
type: string
required:
- name
type: object
x-annotation-package: Zone
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-zones.html#change-name'
x-annotation-postman-example: null
ZoneSetDescriptionAction:
title: ZoneSetDescriptionAction
allOf:
- $ref: '#/definitions/ZoneUpdateAction'
- properties:
description:
type: string
type: object
x-annotation-package: Zone
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-zones.html#set-description'
x-annotation-postman-example: null
ZoneSetKeyAction:
title: ZoneSetKeyAction
allOf:
- $ref: '#/definitions/ZoneUpdateAction'
- properties:
key:
description: 'If `key` is absent or `null`, this field will be removed if it exists.'
type: string
type: object
x-annotation-package: Zone
x-annotation-docs-uri: 'https://docs.commercetools.com/http-api-projects-zones.html#set-key'
x-annotation-postman-example: null
ErrorObject:
title: ErrorObject
discriminator: code
type: object
properties:
code:
type: string
message:
type: string
required:
- code
- message
x-annotation-package: Error
ErrorResponse:
title: ErrorResponse
type: object
properties:
statusCode:
type: integer
message:
type: string
error:
type: string
error_description:
type: string
errors:
type: array
items:
"$ref": "#/definitions/ErrorObject"
required:
- statusCode
- message
x-annotation-package: Error
parameters:
'trait:expandable:expand':
type: string
in: query
name: expand
'trait:query:/^var[.][a-zA-Z0-9]+$/':
description: Predicate parameter values
type: string
in: query
name: '/^var[.][a-zA-Z0-9]+$/'
x-annotation-placeholderParam:
paramName: predicateVar
template: var.<varName>
placeholder: varName
'trait:paging:limit':
description: Number of results returned
type: number
in: query
name: limit
'trait:paging:offset':
description: Number of results skipped
type: number
in: query
name: offset
'trait:paging:withTotal':
description: Calculate total number of results
type: boolean
in: query
name: withTotal
'trait:versioned:version':
format: int64
description: Last seen version of the resource
type: number
in: query
name: version
required: true
'trait:priceSelecting:priceCurrency':
type: string
in: query
name: priceCurrency
'trait:priceSelecting:priceCountry':
type: string
in: query
name: priceCountry
'trait:priceSelecting:priceCustomerGroup':
type: string
in: query
name: priceCustomerGroup
'trait:priceSelecting:priceChannel':
type: string
in: query
name: priceChannel
'trait:priceSelecting:localeProjection':
type: string
in: query
name: localeProjection
'trait:priceSelecting:storeProjection':
type: string
in: query
name: storeProjection
'trait:dataErasure:dataErasure':
type: boolean
in: query
name: dataErasure
responses:
'trait:errorable:400':
description: |
## Bad Request
A 400 is the most commonly expected error response and indicates that a request failed due to providing bad input.
Bad input can be a malformed request body, missing required parameters, wrongly typed or malformed parameters or
a parameter that references another resource that does not exist. Clients need to resolve the problems mentioned
in the response before re-sending the request.
The following general error codes can appear in responses with the HTTP status code `400`:
* `InvalidInput`
Invalid input has been sent to the service.
The client application should validate the input according to the constraints described in the error message
before sending the request.
* `InvalidOperation`
The resource(s) involved in the request are not in a valid state for the operation. The client application
should validate the constraints described in the error message before sending the request.
* `InvalidField`
A field has an invalid value.
Extra fields:
* `field` - String
The name of the field.
* `invalidValue` - *
The invalid value.
* `allowedValues` - Array of * - Optional
A fixed set of allowed values for the field, if any.
* `RequiredField`
A required field is missing a value.
Extra fields:
* `field` - String
The name of the field.
* `DuplicateField`
A value for a field conflicts with an existing duplicate value.
Extra fields:
* `field` - String
The name of the field.
* `duplicateValue` - *
The offending duplicate value.
examples:
application/json:
statusCode: 409
message: Version mismatch. Concurrent modification.
errors:
- code: ConcurrentModification
message: Version mismatch. Concurrent modification.
schema:
$ref: '#/definitions/ErrorResponse'
'trait:errorable:401':
description: |
## Unauthorized
A 401 indicates that the request is not properly authenticated.
schema:
$ref: '#/definitions/ErrorResponse'
'trait:errorable:403':
description: |
## Forbidden
A 403 indicates that the authenticated client is not allowed to perform the request.
schema:
$ref: '#/definitions/ErrorResponse'
'trait:errorable:404':
description: |
## Not Found
A 404 indicates that the addressed resource was not found / does not exist.
The following general error codes can appear in responses with the HTTP status code `404`:
* `ResourceNotFound`
The resource addressed by the request URL does not exist.
'trait:errorable:500':
description: |
## Internal Server Error
A 500 indicates that a request failed due to a server-side problem that needs to be resolved before subsequent
requests can succeed. It either indicates a temporary unavailability or permanent server-side problem that needs
to be reported and resolved.
The following general error codes can appear in responses with the HTTP status code `500`:
* `General`
A server-side problem occurred that is not further specified.
These errors [should be reported](http://support.commercetools.com/).
examples:
application/json:
statusCode: 409
message: Version mismatch. Concurrent modification.
errors:
- code: ConcurrentModification
message: Version mismatch. Concurrent modification.
schema:
$ref: '#/definitions/ErrorResponse'
'trait:errorable:503':
description: |
## Service Unavailable
The following general error codes can appear in responses with the HTTP status code `503`:
* `OverCapacity`
The service is having trouble handling the load. The client application should retry the request with
exponential backoff up to a point where further delay is unacceptable.
* `PendingOperation`
A previous conflicting operation is still pending and needs to finish before the request can succeed.
The client application should retry the request with exponential backoff up to a point where further delay
is unaceptable. If these errors persist, [should be reported](http://support.commercetools.com/).
examples:
application/json:
statusCode: 409
message: Version mismatch. Concurrent modification.
errors:
- code: ConcurrentModification
message: Version mismatch. Concurrent modification.
schema:
$ref: '#/definitions/ErrorResponse'
'trait:deprecatable:200':
description: ''
headers:
X-DEPRECATION-NOTICE:
description: |
As the commercetools platform evolves, some features are superseded by better implementations and should not
be used anymore. The goal of our deprecation process is to communicate at runtime with users if they happen
to use such deprecated feature. To achieve this in a non breaking fashion commercetools uses an additionnal
custom HTTP header called "X-DEPRECATION-NOTICE" with a specific message relative to the deprecation.
type: string
'trait:conflicting:409':
description: |
## Conflict
A 409 indicates that the resource targeted by the request (with the intention to modify or delete the resource),
was modified since the last time the client has requested it. As a reaction, the client will usually want to
request the newest version of the resource to see what has changed and may then decide to apply the same or other
changes to the new version, or discard his changes entirely.
Conflicts indicate a concurrent modification and usually occur on versioned resources, for which the client has
to include the version of the resource whenever he intends to apply modifications to it.
The following general error codes can appear in responses with the HTTP status code `409`:
* `ConcurrentModification`
The request conflicts with the current state of the involved resource(s).
Typically, the request attempts to modify a resource that is out of date,
i.e. that has been modified by another client since the last time it was retrieved.
The client application should resolve the conflict (with or without involving the end-user)
before retrying the request.
examples:
application/json:
statusCode: 409
message: Version mismatch. Concurrent modification.
errors:
- code: ConcurrentModification
message: Version mismatch. Concurrent modification.
schema:
$ref: '#/definitions/ErrorResponse'
paths:
'/{projectKey}/types/{ID}':
post:
description: Update Type by ID
operationId: POST_projectKey-types-ID
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'409':
$ref: '#/responses/trait:conflicting:409'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- schema:
example:
version: 1
actions:
- action: changeName
name:
en: New Name
$ref: '#/definitions/TypeUpdate'
in: body
name: body
required: true
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'manage_types:{projectKey}'
get:
description: Get Type by ID
operationId: GET_projectKey-types-ID
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'view_types:{projectKey}'
delete:
description: Delete Type by ID
operationId: DELETE_projectKey-types-ID
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'409':
$ref: '#/responses/trait:conflicting:409'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- $ref: '#/parameters/trait:versioned:version'
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'manage_types:{projectKey}'
parameters:
- type: string
in: path
name: ID
required: true
- type: string
in: path
name: projectKey
required: true
x-annotation-methodName: withId
'/{projectKey}/zones':
get:
description: Query zones
operationId: GET_projectKey-zones
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- description: |
A query endpoint that supports sorting does so through the sort query parameter. The provided value must be
a valid sort expression. The default sort direction is ASC. The allowed sort paths are typically listed on
the specific query endpoints.
Here are some examples of sort expressions:
name desc
dog.age asc
If multiple sort expressions are specified via multiple sort parameters, they are combined into a composed
sort where the results are first sorted by the first expression, followed by equal values being sorted
according to the second expression, and so on.
Note: The sorting is case sensitive.
type: string
in: query
name: sort
- description: |
If queries support ad-hoc filtering of resources through flexible predicates, they do so via the where query
parameter that accepts a single (possibly compound) predicate to determine whether a specific resource
representation should be included in the result.
The structure of predicates and the names of the fields follow the structure and naming of the fields in the
documented response representation of the query results.
Examples of predicates:
// Compare a field's value to a given value
name = "Peter"
age < 42
age > 42
age <= 42
age >= 42
age <> 42
// Combine any two conditional expressions in a logical conjunction / disjunction
name = "Peter" and age < 42
name = "Peter" or age < 42
// Negate any other conditional expression
not (name = "Peter" and age < 42)
// Check whether a field's value is or is not contained in
// a specified set of values.
age in (42, 43, 44)
age not in (42, 43, 44)
// Check whether an array contains all or any of a set of values
tags contains all ("a", "b", "c")
tags contains any ("a", "b", "c")
// Check whether an array is empty
tags is empty
// Check whether a field exists & has a non-null value
name is defined
name is not defined
// Descend into nested objects
dog(age < 7 and name = "Beethoven")
// Descend into nested arrays of objects
cities(zip > 10000 and zip < 20000)
A query endpoint usually restricts predicates to only be allowed on a specified subset of a resource
representation's fields. The documentation of the endpoint will therefore list fields that can be used
for constructing predicates.
If multiple predicates are specified via multiple where query parameters, the individual predicates are
combined in a logical conjunction, just as if they had been specified in a single where query parameter
and combined with and.
Note: The encoding of the predicates is UTF-8 and the predicate must be URL-encoded in the HTTP request.
type: string
in: query
name: where
- $ref: '#/parameters/trait:expandable:expand'
- $ref: '#/parameters/trait:paging:limit'
- $ref: '#/parameters/trait:paging:offset'
- $ref: '#/parameters/trait:paging:withTotal'
- $ref: '#/parameters/trait:query:/^var[.][a-zA-Z0-9]+$/'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'view_orders:{projectKey}'
post:
description: Create Zone
operationId: POST_projectKey-zones
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'201':
description: ''
examples:
application/json:
id: ebe01381-82be-4e63-9993-d1eb8f8e588b
version: 1
name: US
key: us-zone
locations:
- country: US
createdAt: '2015-01-21T09:22:04.275Z'
lastModifiedAt: '2015-01-21T09:22:04.275Z'
schema:
$ref: '#/definitions/Zone'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- schema:
example:
name: US
locations:
- country: US
$ref: '#/definitions/ZoneDraft'
in: body
name: body
required: true
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'manage_orders:{projectKey}'
parameters:
- type: string
in: path
name: projectKey
required: true
x-annotation-updateable: Zone
x-annotation-deleteable: Zone
x-annotation-createable: ZoneDraft
'/{projectKey}/zones/key={key}':
post:
description: Update Zone by key
operationId: POST_projectKey-zones-key=key
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'409':
$ref: '#/responses/trait:conflicting:409'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- schema:
example:
version: 1
actions:
- action: changeName
name: New Name
$ref: '#/definitions/ZoneUpdate'
in: body
name: body
required: true
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'manage_orders:{projectKey}'
get:
description: Get Zone by key
operationId: GET_projectKey-zones-key=key
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'view_orders:{projectKey}'
delete:
description: Delete Zone by key
operationId: DELETE_projectKey-zones-key=key
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'409':
$ref: '#/responses/trait:conflicting:409'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- $ref: '#/parameters/trait:versioned:version'
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'manage_orders:{projectKey}'
parameters:
- type: string
in: path
name: key
required: true
- type: string
in: path
name: projectKey
required: true
x-annotation-methodName: withKey
'/{projectKey}/zones/{ID}':
post:
description: Update Zone by ID
operationId: POST_projectKey-zones-ID
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'409':
$ref: '#/responses/trait:conflicting:409'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- schema:
example:
version: 1
actions:
- action: changeName
name: New Name
$ref: '#/definitions/ZoneUpdate'
in: body
name: body
required: true
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'manage_orders:{projectKey}'
get:
description: Get Zone by ID
operationId: GET_projectKey-zones-ID
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'view_orders:{projectKey}'
delete:
description: Delete Zone by ID
operationId: DELETE_projectKey-zones-ID
responses:
'200':
$ref: '#/responses/trait:deprecatable:200'
'400':
$ref: '#/responses/trait:errorable:400'
'401':
$ref: '#/responses/trait:errorable:401'
'403':
$ref: '#/responses/trait:errorable:403'
'404':
$ref: '#/responses/trait:errorable:404'
'409':
$ref: '#/responses/trait:conflicting:409'
'500':
$ref: '#/responses/trait:errorable:500'
'503':
$ref: '#/responses/trait:errorable:503'
parameters:
- $ref: '#/parameters/trait:versioned:version'
- $ref: '#/parameters/trait:expandable:expand'
security:
- oauth_2_0:
- 'manage_project:{projectKey}'
- 'manage_orders:{projectKey}'
parameters:
- type: string
in: path
name: ID
required: true
- type: string
in: path
name: projectKey
required: true
x-annotation-methodName: withId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment