Skip to content

Commit 5cafaae

Browse files
LaurentPetardNolwennP
authored andcommitted
PIM-7976: Add reference entity media-file resources
1 parent f400fbe commit 5cafaae

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### Reference entity media file
2+
3+
::: warning
4+
This resource is only available in the [Entreprise Edition](https://www.akeneo.com/enterprise-edition/).
5+
:::
6+
7+
#### Download the media file associated to a reference entity or a record
8+
9+
```php
10+
$client = new \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
11+
12+
$mediaFileResponse = $client->getReferenceEntityMediaFileApi()->download('images/kartell.png');
13+
```
14+
15+
From the response, you can retrieve the file name in the header "Content-Disposition" and the mime type in the header "Content-Type"
16+
17+
#### Create a new media file for a reference entity or a record
18+
19+
```php
20+
$client = new \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
21+
22+
$mediaFileCode = $client->getReferenceEntityMediaFileApi()->create('/tmp/kartell.png');
23+
```

0 commit comments

Comments
 (0)