Giter VIP home page Giter VIP logo

api-php-client-ee's People

Contributors

ahocquard avatar clementgautier avatar damien-carcel avatar doodoune avatar fitn avatar gplanchat avatar laurentpetard avatar leobenoist avatar levflavien avatar mmetayer avatar nidup avatar nolwennp avatar pchasle avatar pierrejolly avatar solivier avatar tamarasaurus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-php-client-ee's Issues

Wrong asset media file code response header

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:
Screenshot 2020-07-12 at 19 37 39

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.

Unable to retrieve a reference file by the download method

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 ?

Invalid format error with ReferenceEntityAttributeApi

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.

Unable to install Akeneo API PHP Client Enterprise edition

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.

ReferenceEntityMediaFileAPI has incorrect header code for Akeneo Serenity

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?

Missing line in AkeneoPimEnterpriseClient.php

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?

ReferenceEntityMediaFileApi cannot recognise code in response

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.

ArgumentCountError in Upsert a list of attribute options

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▕ }

Media upload fails on akeneo 4 while ReferenceEntityMediaFileApi.php prevents successful media upload

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.

Bildschirmfoto 2020-10-09 um 10 12 34

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.