akeneo / api-php-client-ee Goto Github PK
View Code? Open in Web Editor NEWOld PHP client of Akeneo PIM EE API. Moved to https://github.com/akeneo/api-php-client
License: Other
Old PHP client of Akeneo PIM EE API. Moved to https://github.com/akeneo/api-php-client
License: Other
AssetMediaFileApi::extractCodeFromCreationResponse()
looks for a response header Asset-media-file-code
to extract a code of the newly-created asset media file. PIM doesn't return Asset-media-file-code
, it returns Asset-Media-File-Code
(different capitalisation). So the client concludes this header doesn't exist and throws an exception.
Here's a proof that PIM returns a different header:
This is a successful asset media POST request made to Akeneo Serenity edition. As you can see, the response is 201, but the header is different. I don't know why, I checked the source code of Akeneo EE and found that actually Asset-media-file-code
is returned. So I'm not sure what's wrong here.
Maybe it would be a good idea to check for the header in a case-insensitive way (using strcasecmp()
) or just check both Asset-media-file-code
and Asset-Media-File-Code
.
Hello,
There is a method to download a reference file but I don't understand how to use it for my purpose. The method only return a stream content without any other information and we can't use just a content file to really download it :
$response = $this->httpClient->sendRequest('GET', $uri, ['Accept' => '*/*']);
return $response->getBody();
So we have to retrieve in a different way the mime type, the extension and create a new file name in order to download the file whereas these information are accessible directly in the Response object.
Why not just return this object ?
Hi,
I'm trying to add an attribute on a reference entity with the API but I've got a really weird error :
The attribute has an invalid format.
I thought it was a mistake on my side but then I tried to add the same format as in your documentation here :
https://api.akeneo.com/php-client/resources.html#reference-entity-attribute
$client->getReferenceEntityAttributeApi()->upsert('brand', 'description', [ 'code' => 'description', 'labels' => [ 'en_US' => 'Description' ], 'type' => 'text', 'localizable' => true, 'scopable' => true, 'is_required_for_completeness' => false ]);
I tried to remove every lines except type and code and I still get the error.
What did I missed ?
Thank for your help in advance.
In the readme https://github.com/akeneo/api-php-client-ee#php-akeneo-pim-api it is not stated clearly which PHP-API Version to use for Akeneo 5. Can we clarify that Akeneo 5 is supported?
Hi,
I'm using Akeneo enterprise edition. I try to install EE API PHP Client extension.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for akeneo/api-php-client-ee ^2.0 -> satisfiable by akeneo/api-php-client-ee[v2.0.0].
- akeneo/api-php-client-ee v2.0.0 requires akeneo/api-php-client 2.0.x-dev@dev -> satisfiable by akeneo/api-php-client[2.0.x-dev] but these conflict with your requirements or minimum-stability.
Installation failed, reverting ./composer.json to its original content.
Hi,
While building a migration using this app, I discovered the writing of files to reference entities was failing. I traced the error down to the following line of code:
src/Api/ReferenceEntityMediaFileApi.php
The issue is extractCodeFromCreationResponse looks for this header:
!isset($headers['Reference-entities-media-file-code'][0]
The case is wrong on that header, and it works when manually changed to:
!isset($headers['Reference-Entities-Media-File-Code'][0]
I will submit a PR for this, but I noticed there was a similar PR #97 merged in with the incorrect header. Does this header change per Akeneo version?
In master, a partner noticed an error (internal ref SDS-14209)
Type error: Argument 13 passed to Akeneo\Pim\ApiClient\AkeneoPimClient::__construct() must be an instance of Akeneo\Pim\ApiClie
nt\Api\MeasurementFamilyApiInterface, instance of Akeneo\Pim\ApiClient\Api\AssociationTypeApi given, called in /var/www/symfony
/vendor/akeneo/api-php-client-ee/src/AkeneoPimEnterpriseClient.php on line 155
Fixed by adding a missing line:
What’s actually missing in https://github.com/akeneo/api-php-client-ee/blob/master/src/AkeneoPimEnterpriseClient.php
between line 152 and 153:
$measureFamilyApi,
$associationTypeApi,
is 'MeasurementFamilyApiInterface $measurementFamilyApi' like in https://github.com/akeneo/api-php-client/blob/master/src/AkeneoPimClient.php (line 92)
Could you please add it in master?
Hi All,
The method ReferenceEntityMediaFileApi::extractCodeFromCreationResponse checks the incorrect header key here:
https://github.com/akeneo/api-php-client-ee/blob/1577caa4ee0f94749d331cc6a225250620cd568c/src/Api/ReferenceEntityMediaFileApi.php#L76
Instead of the $headers['Reference-entities-media-file-code']
it should be $headers['Reference-Entities-Media-File-Code']
Without this fix it is impossible to create a media file for the reference entity. Could you please adjust it?
Thank you.
Hi,
In the documentation it says that the method getAttributeOptionApi()->upsertList(), only has one argument or parameter which is an array, but when executing it an error is generated since it is waiting for two arguments.
What is the correct way to invoke this method?
Example:
$client->getAttributeOptionApi()->upsertList([
[
'code' => 'black',
'attribute' => 'a_simple_select',
'sort_order' => 2,
'labels' => [
'en_US' => 'Black',
'fr_FR' => 'Noir',
]
],
[
'code' => 'white',
'attribute' => 'a_simple_select',
'sort_order' => 3,
'labels' => [
'en_US' => 'White',
'fr_FR' => 'Blanc',
],
],
]);
Error:
ArgumentCountError
Too few arguments to function Akeneo\Pim\ApiClient\Api\AttributeOptionApi::upsertList(), 1 passed in \Akeneo\AttributeOption.php on line 61 and exactly 2 expected
at vendor\akeneo\api-php-client\src\Api\AttributeOptionApi.php:107
103▕
104▕ /**
105▕ * {@inheritdoc}
106▕ */
➜ 107▕ public function upsertList($attributeCode, $attributeOptions): \Traversable
108▕ {
109▕ return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions);
110▕ }
111▕ }
Hey people,
the following bug appears on akeneo 4 (using akeneo 4 cloud serenity):
When using ReferenceEntityMediaFileApi to upload media,
$imageCode = $client->getReferenceEntityMediaFileApi()->create($pathToLocalFile);
you'll get a:
Fatal error: Uncaught Akeneo\Pim\ApiClient\Exception\RuntimeException: The response does not contain the code of the created media-file. in /Users/myaccount/Development/project-dir/akeneo-api/vendor/akeneo/api-php-client-ee/src/Api/ReferenceEntityMediaFileApi.php:77
This is due to a incorrect (case sensitive) Header Reference. Using the correct header, everything works fine.
It expects: Reference-entities-media-file-code
Server returns: Reference-Entities-Media-File-Code
Please also see attached screenshot, to get a quicker understanding of the problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.