Skip to content

Commit ce4bee8

Browse files
committed
Merge branch 'master' into 'php-client-ce'
2 parents 8ef7040 + 6ae3a9f commit ce4bee8

File tree

10 files changed

+325
-100
lines changed

10 files changed

+325
-100
lines changed

content/files/Akeneo PIM API.postman_collection.json

Lines changed: 184 additions & 75 deletions
Large diffs are not rendered by default.

content/rest-api/filter.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ You can filter product values on several attributes at the same time.
295295
```
296296

297297
### Via locale
298-
If you want to receive for each product only product values on specific locales, you can specify it thanks to the `locales` query parameter.
298+
If you want to receive for each product only product values on specific locales, as well as the product values of the non localizable attributes, you can specify it thanks to the `locales` query parameter.
299299

300300
#### Example
301-
To get products with only product values regarding the `en_US` locale, you can use the following URL.
301+
To get products with only product values regarding the `en_US` locale (+ the product values of the non localizable attributes), you can use the following URL.
302302
```
303303
/api/rest/v1/products?locales=en_US
304304
```
@@ -309,16 +309,22 @@ You can filter product values on several locales at the same time.
309309
```
310310

311311
### Via channel
312-
If you want to receive for each product only product values about a specific channel, you can specify it thanks to the `scope` query parameter.
312+
There is also a `scope` query parameter that will allow you to:
313+
- get only the selection of products that are in the tree linked to the channel you specified,
314+
- get only the product values for this specific channel, as well as the product values of the non scopable attributes.
313315

314316
#### Example
315-
To get products with only product values regarding the `ecommerce` scope, you can use the following URL.
317+
To get products from the tree linked to the `ecommerce` channel with only product values regarding the `ecommerce` channel (+ the product values of the non scopable attributes), you can use the following URL.
316318
```
317319
/api/rest/v1/products?scope=ecommerce
318320
```
319321

320322
:::warning
321-
Note that you cannot filter product values on several channels.
323+
Note that you cannot use this filter on several channels.
324+
:::
325+
326+
:::info
327+
When using this query parameter, you will never be able to retrieve products that are not categorized. This is due to the fact that we only return the selection of products that are in the tree linked to the given channel. In other words, if a given product is not categorized in this tree, you won't receive it.
322328
:::
323329

324330
## Filter locales

content/rest-api/security.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ curl -X POST http://your-host/api/oauth/v1/token \
159159
}'
160160
```
161161

162+
:::info
163+
The content type `application/x-www-form-urlencoded` is also supported.
164+
:::
165+
162166
:::warning
163167
If you experience any error, please check the [troubleshooting guide](/documentation/troubleshooting.html#missing-client-id).
164168
:::

content/swagger/resources/families/definitions/family.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ properties:
2424
attribute_requirements:
2525
type: object
2626
description: Attributes codes of the family that are required for the completeness calculation for each channel
27-
x-validation-rules: "• Each string of these arrays are existing attributes codes 
• These attribute codes are in the array of the property `attributes` 
• The `channelCode` is the code of an existing and activated channel"
27+
x-validation-rules: "• Each string of these arrays is an existing attribute code 
• These attribute codes are in the array of the property `attributes` 
• The `channelCode` is the code of an existing and activated channel"
2828
properties:
2929
channelCode:
3030
type: array

content/swagger/resources/families/definitions/family_variant.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ properties:
1717
type: integer
1818
description: Enrichment level
1919
x-immutable: true
20-
attributes:
20+
x-validation-rules: "• Number representing the level of the attribute set. 
• It should be equal to 1 or 2. 
• If you specify the level 2, you have to specify the level 1 as well."
21+
axes:
2122
type: array
22-
description: Each string of the array is an attribute code bind to this enrichment level
23+
description: Codes of attributes used as variant axes
24+
x-immutable: true
2325
items:
2426
type: string
2527
default: []
26-
axes:
28+
x-validation-rules: "• Should be an array of maximum 5 existing attribute codes 
• These attributes should belong to the family of the family variant 
• Only the following attribute types are allowed: `simple select`, `multi select`, `reference data`, `metric`, `boolean` 
• Attributes cannot be scopable, nor localizable nor locale specific 
• Attributes used as axes in one level cannot be used as axes or as attributes in the other level"
29+
attributes:
2730
type: array
28-
description: Each string of the array is an attribute code that will be used as variant axis
31+
description: Codes of attributes bind to this enrichment level
2932
items:
3033
type: string
3134
default: []
35+
x-validation-rules: "• Should be an array of existing attribute codes 
• These attributes should belong to the family of the family variant 
• Attributes used as attribute in one level cannot be used as axes or as attributes in the other level 
• Attributes that are `unique value` or `identifier` are automatically distributed to the lower level."
36+
3237
labels:
3338
type: object
3439
description: Family variant labels for each locale

content/swagger/resources/families/routes/families_code_variants.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,47 @@ post:
7979
$ref: "#/responses/415Error"
8080
422:
8181
$ref: "#/responses/422Error"
82+
patch:
83+
summary: Update/create several family variants
84+
operationId: "patch_families__family_code__variants"
85+
tags:
86+
- Families
87+
x-versions:
88+
- 2.0
89+
description: This endpoint allows you to update and/or create several family variants at once, for a given family.
90+
x-body-by-line: Contains several lines, each line is a family in JSON standard format
91+
parameters:
92+
- $ref: '#/parameters/family_code'
93+
- name: body
94+
in: body
95+
schema:
96+
$ref: "#/definitions/FamilyVariant"
97+
x-examples:
98+
x-example-1:
99+
'{"code": "shoes_by_size", "variant_attribute_sets": [{"level": 1, "axes": ["size"], "attributes": ["color"]}]}'
100+
x-example-2:
101+
'{"code": "shoes_by_color","labels": {"en_US": "Shoes by color"}}'
102+
x-example-3:
103+
'{"code": "shoes_without_axes", "variant_attribute_sets": [{"level": 1, "axes": [], "attributes": ["color"]}]}'
104+
responses:
105+
200:
106+
description: OK
107+
x-details: Returns a plain text response whose lines are JSON containing the status of each update or creation
108+
x-no-entity: true
109+
schema:
110+
$ref: "#/definitions/ErrorByLine"
111+
examples:
112+
x-example-1:
113+
'{"line":1,"code":"shoes_by_size","status_code":201}'
114+
x-example-2:
115+
'{"line":2,"code":"shoes_by_color","status_code":204}'
116+
x-example-3:
117+
'{"line":3,"code":"mug","status_code":422, "message":"There should be at least one attribute defined as axis for the attribute set for level "1""}'
118+
401:
119+
$ref: "#/responses/401Error"
120+
403:
121+
$ref: "#/responses/403Error"
122+
413:
123+
$ref: "#/responses/413Error"
124+
415:
125+
$ref: "#/responses/415ErrorStream"

content/swagger/resources/families/routes/families_code_variants_code.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,34 @@ get:
2323
$ref: "#/responses/404Error"
2424
406:
2525
$ref: "#/responses/406Error"
26+
patch:
27+
summary: Update/create a family a family variant
28+
operationId: "patch_families__family_code__variants__code__"
29+
tags:
30+
- Families
31+
x-versions:
32+
- 2.0
33+
description: This endpoint allows you to update a given family variant. Know more about <a href="/documentation/update.html#update-behavior">Update behavior</a>. Note that if no family variant exists for the given code, it creates it.
34+
parameters:
35+
- $ref: '#/parameters/family_code'
36+
- $ref: '#/parameters/code'
37+
- name: body
38+
in: body
39+
required: true
40+
schema:
41+
$ref: "#/definitions/FamilyVariant"
42+
responses:
43+
201:
44+
$ref: "#/responses/Created"
45+
204:
46+
$ref: "#/responses/NoContent"
47+
400:
48+
$ref: "#/responses/400Error"
49+
401:
50+
$ref: "#/responses/401Error"
51+
403:
52+
$ref: "#/responses/403Error"
53+
415:
54+
$ref: "#/responses/415Error"
55+
422:
56+
$ref: "#/responses/422Error"

content/swagger/resources/token.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ post:
99
- 2.0
1010
x-no-token: true
1111
parameters:
12+
- name: Content-type
13+
in: header
14+
type: string
15+
description: Equal to 'application/json' or 'application/x-www-form-urlencoded', no other value allowed
16+
required: true
1217
- name: Authorization
1318
in: header
1419
type: string
1520
required: true
1621
description: Equal to 'Basic xx', where 'xx' is the base 64 encoding of the client id and secret. Find out how to generate them in the <a href="/documentation/security.html#create-an-oauth-client">Create an OAuth client</a> section.
1722
- name: body
1823
in: body
24+
x-form-data: true
1925
schema:
2026
type: object
2127
properties:

src/api-reference/reference.handlebars

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,26 @@
228228
{{#if x-warning}}
229229
<a href="#" data-placement="top" data-toggle="tooltip" title="{{{x-warning}}}"> <i class="fa fa-warning fa-warning-color"></i> </a>
230230
{{/if}}
231-
&bull; {{{description}}}
231+
{{#with items}}
232+
{{#if properties}} : [ <br> &nbsp; &nbsp; &nbsp; &nbsp; { <br>
233+
{{#each properties}}
234+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
235+
<code>{{{@key}}}</code>
236+
<em>
237+
({{{type}}}
238+
{{#if items}}
239+
[{{{items.type}}}
240+
]{{/if}})
241+
</em>
242+
&bull; {{{description}}} <br>
243+
{{/each}}
244+
&nbsp; &nbsp; &nbsp; &nbsp; } <br> &nbsp; &nbsp; ]
245+
{{else}}
246+
&bull; {{{../description}}}
247+
{{/if}}
248+
{{else}}
249+
&bull; {{{description}}}
250+
{{/with}}
232251
</p>
233252
{{/each}}
234253
<p>}</p>
@@ -296,6 +315,7 @@
296315
<em> ({{{type}}} {{#if items}} [{{{items.type}}}] {{/if}}) </em>
297316
{{#if properties}}: { <br>
298317
{{#each properties}}
318+
&nbsp; &nbsp;
299319
<code>{{{@key}}}</code>
300320
<em>
301321
({{{type}}}
@@ -317,7 +337,6 @@
317337
&bull; {{{description}}}{{#unless @last}} <br> {{/unless}}
318338
{{/each}}
319339
<br>&nbsp; &nbsp; }
320-
<br>
321340
{{else}}
322341
{{#with items}}
323342
{{#if allOf}}
@@ -350,13 +369,11 @@
350369
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
351370
} <br>
352371
{{else}}
353-
&bull; {{{description}}}
354-
<br>
372+
&bull; {{{description}}} <br>
355373
{{/if}}
356374
{{/each}}
357375
{{/each}}
358-
&nbsp; &nbsp; &nbsp; &nbsp; } <br> &nbsp; &nbsp;
359-
]
376+
&nbsp; &nbsp; &nbsp; &nbsp; } <br> &nbsp; &nbsp; ]
360377
{{/if}}
361378
{{#if properties}} : [
362379
<br> &nbsp; &nbsp; &nbsp; &nbsp; { <br>
@@ -371,18 +388,19 @@
371388
</em>
372389
&bull; {{{description}}} <br>
373390
{{/each}}
374-
&nbsp; &nbsp; &nbsp; &nbsp; } <br> &nbsp; &nbsp; ] <br>
391+
&nbsp; &nbsp; &nbsp; &nbsp; } <br> &nbsp; &nbsp; ]
375392
{{else}}
376-
&bull; {{{description}}} <br>
393+
&bull; {{{description}}}
377394
{{/if}}
395+
{{else}}
396+
&bull; {{{description}}}
378397
{{/with}}
379398
{{/if}}
380-
{{#unless @last}} <br> {{/unless}}
381399
{{/each}}
382-
&nbsp; }
383-
{{else}}
384-
&bull; {{{description}}}</p>
385-
{{/if}}
400+
<br> &nbsp; }
401+
{{else}}
402+
&bull; {{{description}}}
403+
{{/if}}
386404
{{/each}}
387405
{{#each allOf}}
388406
{{#each properties}}

src/getting-started-admin.handlebars

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,23 @@
8383
<h3>With a command line</h3>
8484
<p>Alternatively, you can create the client id and secret with a single command line directly on the PIM server.</p>
8585
<h4>With the 2.0 version</h4>
86-
<pre class="hljs"><code>php bin/console pim:oauth-server:create-client \
86+
<pre class="hljs"><code>php bin/console pim:oauth-server:create-client my-customer-account \
8787
--grant_type=<span class="hljs-string">"password"</span> \
8888
--grant_type=<span class="hljs-string">"refresh_token"</span> \
8989
--env=prod</code>
9090
</pre>
9191
<h4>With the 1.7 version</h4>
9292
<pre class="hljs"><code>php app/console pim:oauth-server:create-client \
93+
--label=<span class="hljs-string">"my-customer-account"</span>
9394
--grant_type=<span class="hljs-string">"password"</span> \
9495
--grant_type=<span class="hljs-string">"refresh_token"</span> \
9596
--env=prod</code>
9697
</pre>
9798
<p>You will get something like:</p>
9899
<pre class="hljs"><code>A new client has been added:
99100
client_id: 4gm4rnoizp8gskgkk080ssoo80040g44ksowwgw844k44sc00s
100-
secret: 5dyvo1z6y34so4ogkgksw88ookoows00cgoc488kcs8wk4c40s</code>
101+
secret: 5dyvo1z6y34so4ogkgksw88ookoows00cgoc488kcs8wk4c40s
102+
label: my-customer-account</code>
101103
</pre>
102104
<p>Give by any mean of your choice these credentials to Peter. And that's it! Thanks to it, he will be able to finally access the API. Take a look to the <a href="getting-started.html">Developer Getting started</a> to know how.</p>
103105
<div class="alert alert-info">To revoke the access, you just have to revoke it from the <code>API connections</code> screen (in 2.0) or run a single command line (in 1.7). To have more details, take a look at the <a href="/documentation/security.html">Security</a> section of the documention.</div>

0 commit comments

Comments
 (0)