diff --git a/api-specs/api/examples/channel-updated.example.json b/api-specs/api/examples/channel-updated.example.json new file mode 100644 index 000000000..ff1d5b633 --- /dev/null +++ b/api-specs/api/examples/channel-updated.example.json @@ -0,0 +1,13 @@ +{ + "id": "ac390383-370f-43f8-a534-db1604cb96a8", + "key": "commercetools", + "version": 2, + "name": { + "en": "New Name" + }, + "roles": [ + "InventorySupply" + ], + "createdAt": "2015-05-28T09:48:35.023Z", + "lastModifiedAt": "2015-06-02T09:48:35.023Z" +} diff --git a/api-specs/api/resources/channels.raml b/api-specs/api/resources/channels.raml index e382fe0bf..5171fb25c 100644 --- a/api-specs/api/resources/channels.raml +++ b/api-specs/api/resources/channels.raml @@ -60,11 +60,48 @@ post: body: application/json: example: !include ../examples/channel-update.example.json + responses: + 200: + body: + application/json: + example: !include ../examples/channel-updated.example.json + delete: + securedBy: [oauth_2_0: { scopes: ['manage_products:{projectKey}'] }] + description: | + Returns a [ReferenceExists](ctp:api:type:ReferenceExistsError) error if other resources reference the Channel to be deleted. + responses: + 200: + body: + application/json: + example: !include ../examples/channel.example.json + +/key={key}: + (methodName): withKey + type: + baseResource: + uriParameterName: key + resourceType: Channel + resourceUpdateType: ChannelUpdate + get: + securedBy: [oauth_2_0: { scopes: ['view_products:{projectKey}'] }] responses: 200: body: application/json: example: !include ../examples/channel.example.json + head: + securedBy: [oauth_2_0: { scopes: ['view_products:{projectKey}'] }] + description: Checks if a Channel exists for a given `key`. Returns a `200 OK` status if the Channel exists or a `404 Not Found` otherwise. + post: + securedBy: [oauth_2_0: { scopes: ['manage_products:{projectKey}'] }] + body: + application/json: + example: !include ../examples/channel-update.example.json + responses: + 200: + body: + application/json: + example: !include ../examples/channel-updated.example.json delete: securedBy: [oauth_2_0: { scopes: ['manage_products:{projectKey}'] }] description: | diff --git a/api-specs/graphql/schema.sdl b/api-specs/graphql/schema.sdl index 4ce241612..ccefa4840 100644 --- a/api-specs/graphql/schema.sdl +++ b/api-specs/graphql/schema.sdl @@ -5571,8 +5571,20 @@ type Mutation { "Queries with specified key" key: String): Category createChannel(draft: ChannelDraft!): Channel - updateChannel(id: String!, version: Long!, actions: [ChannelUpdateAction!]!): Channel - deleteChannel(id: String!, version: Long!): Channel + updateChannel(version: Long!, actions: [ChannelUpdateAction!]!, + + "Queries with specified ID" + id: String, + + "Queries with specified key" + key: String): Channel + deleteChannel(version: Long!, + + "Queries with specified ID" + id: String, + + "Queries with specified key" + key: String): Channel createOrUpdateCustomObject(draft: CustomObjectDraft!): CustomObject deleteCustomObject(version: Long,