Skip to content

Commit 3932b70

Browse files
author
Jens Schulze
authored
Merge pull request #31 from commercetools/api-clients
Api clients
2 parents 64c2e02 + b55bb91 commit 3932b70

File tree

10 files changed

+110
-1
lines changed

10 files changed

+110
-1
lines changed

api.raml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,4 @@ resourceTypes:
163163
/zones: !include resources/zones.raml
164164
/me: !include resources/me.raml
165165
/extensions: !include resources/extensions.raml
166+
/api-clients: !include resources/api-clients.raml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "api-client-name",
3+
"scope": "view_products"
4+
}

examples/api-client.example.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "api-client-id",
3+
"name": "api-client-name",
4+
"scope": "view_products",
5+
"createdAt": "2018-01-01T00:00:00.001Z",
6+
"lastUsedAt": "2017-9-10",
7+
"secret": "secret-passphrase"
8+
}

examples/api-clients.example.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"offset": 0,
3+
"count": 1,
4+
"total": 1,
5+
"results": [
6+
{
7+
"id": "api-client-id",
8+
"name": "api-client-name",
9+
"scope": "view_products",
10+
"createdAt": "2018-01-01T00:00:00.001Z",
11+
"lastUsedAt": "2017-9-10",
12+
"secret": "secret-passphrase"
13+
}
14+
]
15+
}

resources/api-clients.raml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
type:
2+
baseDomain:
3+
resourceType: ApiClient
4+
resourceQueryType: ApiClientPagedQueryResponse
5+
resourceDraft: ApiClientDraft
6+
resourceExample: !include ../examples/api-client.example.json
7+
resourceQueryExample: !include ../examples/api-clients.example.json
8+
resourceCreateExample: !include ../examples/api-client-create.example.json
9+
whereExample: scopes = view_products
10+
sortExample: createdAt asc
11+
description: |
12+
Manage your API Clients via an API. Useful for Infrastructure-as-Code tooling, and regularly rotating API secrets.
13+
get:
14+
securedBy: [oauth_2_0: {scopes: ["manage_api_clients:{projectKey}", "view_api_clients:{projectKey}"]}]
15+
post:
16+
securedBy: [oauth_2_0: {scopes: ["manage_api_clients:{projectKey}"]}]
17+
/{ID}:
18+
(methodName): withId
19+
type:
20+
baseResource:
21+
uriParameterName: ID
22+
resourceType: ApiClient
23+
resourceExample: !include ../examples/api-client.example.json
24+
get:
25+
securedBy: [oauth_2_0: {scopes: ["manage_api_clients:{projectKey}", "view_api_clients:{projectKey}"]}]
26+
delete:
27+
securedBy: [oauth_2_0: {scopes: ["manage_api_clients:{projectKey}"]}]

resources/states.raml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ type:
1212
sortExample: createdAt asc
1313
description: |
1414
The commercetools platform allows you to model states of certain objects, such as orders, line items, products,
15-
reviews, and payments in order to define finite state machines reflecting the business logic you’d like to implement.
15+
reviews, and payments in order to define finite state machines reflecting the business logic you’d like to
16+
implement.
1617
get:
1718
securedBy: [oauth_2_0: {scopes: ["manage_project:{projectKey}", "view_orders:{projectKey}"]}]
1819
post:

types/api-client/ApiClient.raml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#%RAML 1.0 DataType
2+
(package): ApiClient
3+
(docs-uri): https://docs.commercetools.com/http-api-projects-apiClients.html#apiclient
4+
5+
displayName: ApiClient
6+
7+
type: object
8+
properties:
9+
id:
10+
type: string
11+
name:
12+
type: string
13+
scope:
14+
type: string
15+
createdAt:
16+
type: datetime
17+
lastUsedAt:
18+
type: date-only
19+
secret?:
20+
type: string
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#%RAML 1.0 DataType
2+
(package): ApiClient
3+
(docs-uri): https://docs.commercetools.com/http-api-projects-apiClients.html#apiclientdraft
4+
5+
displayName: ApiClientDraft
6+
7+
type: object
8+
properties:
9+
name:
10+
type: string
11+
scope:
12+
type: string
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#%RAML 1.0 DataType
2+
(package): ApiClient
3+
4+
displayName: ApiClientPagedQueryResponse
5+
6+
type: object
7+
properties:
8+
count:
9+
type: number
10+
format: int64
11+
total?:
12+
type: number
13+
format: int64
14+
offset:
15+
type: number
16+
format: int64
17+
results:
18+
type: ApiClient[]

types/types.raml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
PagedQueryResponse: !include PagedQueryResponse.raml
22
Update: !include Update.raml
33
UpdateAction: !include UpdateAction.raml
4+
ApiClient: !include api-client/ApiClient.raml
5+
ApiClientDraft: !include api-client/ApiClientDraft.raml
6+
ApiClientPagedQueryResponse: !include api-client/ApiClientPagedQueryResponse.raml
47
CartDiscount: !include cart-discount/CartDiscount.raml
58
CartDiscountCustomLineItemsTarget: !include cart-discount/CartDiscountCustomLineItemsTarget.raml
69
CartDiscountDraft: !include cart-discount/CartDiscountDraft.raml

0 commit comments

Comments
 (0)