Skip to content

Issue in creating new Destination by Notifications API #539

@mtkumar82

Description

@mtkumar82

Hi,
I am using your extension in laravel project to integrate Amazon SP API, Its working for products, Feeds API correctly, But when I am trying it for Notifications API to create Destinations for my store, Its giving below error.

[403] Error connecting to the API (https://sellingpartnerapi-eu.amazon.com/notifications/v1/destinations)

I had setup the SQS queue in my amazon account as per the API documentation below. But its not working for me, Can you please help me what wrong I am doing there, I also sending my code here to review.

$createDestinationRequest = new CreateDestinationRequest(); $destinationResourceSpecification = new DestinationResourceSpecification(); $SqsResource = new SqsResource(); $SqsResource->setArn('MyQUEUEARNNUMBERHERE');
            $destinationResourceSpecification->setSqs($SqsResource);

            $createDestinationRequest->setResourceSpecification($destinationResourceSpecification);
            $createDestinationRequest->setName("Zayron");
           
            
           // $getDestination                 = $this->service->notifications()->getDestinations($accessToken,$region);
            
            $createDestination              = $this->service->notifications()->createDestination($accessToken,$region,$createDestinationRequest);
            echo "<pre>";
            print_r($accessToken);
            die();

/*
Step 1. Grant Selling Partner API permission to write to your SQS queue

To receive notifications you must grant Selling Partner API permission to write to your SQS queue.

Open the [AWS Management Console](https://console.aws.amazon.com/console) and sign in with your AWS credentials.

From the console, open Amazon Simple Queue Service.

Select the Standard queue where you want to receive notifications.

Choose the Access Policy tab.

From the Access policy (Permissions) section, select Edit. The Edit Test Queue page opens.

Scroll down to Access policy, then select the Policy generator link. The AWS Policy Generator opens in a new tab.

In Step 1 of the policy generator, select SQS Queue Policy.

In Step 2 of the policy generator:

Set Effect to Allow.
Set Principal to 437568002678.
Set Actions to SendMessage and GetQueueAttributes.
Enter the SQS ARN value in Amazon Resource Name (ARN).
Choose Add Statement and verify the details.

In Step 3 of the policy generator, select Generate Policy. A dialog box with the new policy opens.

Copy the policy.

Navigate back to the Amazon SQS queue, open the Access policy tab, then paste the policy into the Access Policy (Permissions) section.

Save the changes.

Reference the queue's Details section and note the ARN for this queue. You will pass this value using the arn parameter when you call the createDestination operation in [Step 2. Create a destination](https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide#step-2-create-a-destination).

*/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions