Skip to content

Commit d8831bf

Browse files
committed
feat(API-1860): Add API Client Product Draft UUID routes
1 parent 470a9ba commit d8831bf

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
### Product draft UUID
2+
3+
::: info
4+
The following endpoints are largely the same as for [products](/php-client/resources.html#products-draft). The difference? Here, you can query or drafts identified by their uuid. More information [here](/content/getting-started/from-identifiers-to-uuid-7x/welcome.md).
5+
:::
6+
7+
#### Get a product draft
8+
::: php-client-availability versions=10.0
9+
10+
```php
11+
$client = new \Akeneo\Pim\ApiClient\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
12+
13+
/*
14+
* Returns an array like this:
15+
* [
16+
* 'uuid' => '12951d98-210e-4bRC-ab18-7fdgf1bd14f3',
17+
* 'enabled' => true,
18+
* 'family' => 'tshirt',
19+
* 'categories' => ['summer_collection'],
20+
* 'groups' => [],
21+
* 'values' => [
22+
* 'name' => [
23+
* [
24+
* 'data' => 'Top',
25+
* 'locale' => 'en_US',
26+
* 'scope' => null
27+
* ],
28+
* [
29+
* 'data' => 'Débardeur',
30+
* 'locale' => 'fr_FR',
31+
* 'scope' => null
32+
* ],
33+
* ],
34+
* ],
35+
* 'created' => '2016-06-23T18:24:44+02:00',
36+
* 'updated' => '2016-06-25T17:56:12+02:00',
37+
* 'associations' => [
38+
* 'PACK' => [
39+
* 'products' => [
40+
* 'sunglass'
41+
* ],
42+
* 'groups' => [],
43+
* 'product_models' => []
44+
* ],
45+
* ],
46+
* 'quantified_associations' => [
47+
* 'PRODUCT_SET' => [
48+
* 'products' => [
49+
* ['uuid' => '5719e119-613c-49af-9244-fa39a9e0cb1d', 'quantity' => 2],
50+
* ],
51+
* 'product_models' => [],
52+
* ],
53+
* ],
54+
* 'metadata' => [
55+
* 'workflow_status' => 'draft_in_progress',
56+
* ],
57+
* ]
58+
*/
59+
$draftProduct = $client->getProductDraftUuidApi()->get('12951d98-210e-4bRC-ab18-7fdgf1bd14f3');
60+
```
61+
62+
You can get more information about the returned format of the product values [here](/concepts/products.html#focus-on-the-product-values).
63+
64+
The field `metadata` is specific to Akeneo PIM Enterprise Edition. The status of the draft is specified in this field.
65+
66+
#### Submit a product draft for approval
67+
::: php-client-availability versions=10.0
68+
69+
```php
70+
$client = new \Akeneo\Pim\ApiClient\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
71+
72+
$client->getProductDraftUuidApi()->submitForApproval('12951d98-210e-4bRC-ab18-7fdgf1bd14f3');
73+
```
74+
75+
It is mandatory that the user already created a draft for this product, and that this draft was not approved yet.

tasks/build-doc.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,11 @@ gulp.task('create-app-catalog-md', function () {
672672
});
673673

674674
gulp.task('create-products-md', function () {
675-
return gulp.src(['content/php-client/resources/products/products.md','content/php-client/resources/products/products-uuid.md','content/php-client/resources/products/product-models.md','content/php-client/resources/products/*.md'])
675+
return gulp.src(['content/php-client/resources/products/products.md',
676+
'content/php-client/resources/products/products-uuid.md',
677+
'content/php-client/resources/products/product-models.md',
678+
'content/php-client/resources/products/product-drafts-uuid.md',
679+
'content/php-client/resources/products/*.md'])
676680
.pipe(concat('products.md'))
677681
.pipe(insert.prepend('## Products\n'))
678682
.pipe(gulp.dest('tmp/php-client-resources/'));

0 commit comments

Comments
 (0)