Why do I get this error using AWS Marketplace GetEntitlements?

96 Views Asked by At

I am trying to interface my php code with AWS Marketplace. There seems to be no example in PHP, anywhere.

$client = new MarketplaceMetering\MarketplaceMeteringClient($config);
$request = array();
$request['ProductCode']=ProductCode;
$request['Filter']['CUSTOMER_IDENTIFIER']=$result['CustomerIdentifier'];
$entitlement = $client->GetEntitlements( $request);

I am getting the following error and don't know why?

Type: InvalidArgumentException

Message: Operation not found: GetEntitlements

Filename: /app/vendor/aws/aws-sdk-php/src/AwsClient.php

2

There are 2 best solutions below

0
On BEST ANSWER

You need to use MarketplaceEntitlementServiceClient to interact with the AWS Marketplace Entitlement Service. It supports GetEntitlements operation.

$result = $client->getEntitlements([/* ... */]);
$promise = $client->getEntitlementsAsync([/* ... */]);

Hope it helps.

0
On

I should have used this $marketplaceentitlementservice = new MarketplaceEntitlementServiceClient($config);

instead of the MarketplaceMeteringClient.