amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
580 stars 730 forks source link

[BUG] Documentation #1180

Closed whowhatwhen closed 2 years ago

whowhatwhen commented 3 years ago

If you need help troubleshooting a problem with Selling Partner APIs, please open a support case. Issues are for reporting documentation bugs and enhancements only.

My support ticket was closed. You charged me $40 then deactivated my account. I get the following email from you:

We have closed this case because Amazon has deactivated your account. Refer to your Account Health Dashboard to learn more about the status of your account.

View your Account Health Dashboard at https://sellercentral.amazon.com/performance/dashboard?ref=ah_em_sps or select Account Health on the home screen of the Amazon Seller app on your iOS or Android device.

Regards,
Amazon Selling Partner Support

Describe the bug A clear and concise description of what the bug is.

I am trying to track packages. I am using https://github.com/amzn/selling-partner-api-docs (unofficial) but an example in cURL would also work.

URL of the content on GitHub Please provide the GitHub URL for the documentation where you see the bug.

NA

Description of what the documentation currently says Please describe the section/paragraph of the documentation where you see the bug.

There is no example for tracking packages

Description of what the documentation should say A clear and concise description of the guidance you expected to see in the documentation.

It should have an example of how to track packages.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

I am using the following code:

package main

import (
    "context"
    "log"
    "net/http"
    "net/http/httputil"

    "gopkg.me/selling-partner-api-sdk/merchantFulfillment"
    sp "gopkg.me/selling-partner-api-sdk/pkg/selling-partner"

    "github.com/google/uuid"
    "github.com/pkg/errors"
)

func main() {

    sellingPartner, err := sp.NewSellingPartner(&sp.Config{
        ClientID:     "amzn1.application-oa2-client.83...",
        ClientSecret: "3795e5130....",
        RefreshToken: "Atzr|IwEBI....",
        AccessKeyID:  "AKIA...",
        SecretKey:    "kt9...",
        Region:       "us-west-2",
        RoleArn:      "arn:aws:iam::75...:role/mynicerole",
    })

    if err != nil {
        panic(err)
    }

    endpoint := "https://sellingpartnerapi-na.amazon.com"

    client, err := merchantFulfillment.NewClientWithResponses(endpoint,
        merchantFulfillment.WithRequestBefore(func(ctx context.Context, req *http.Request) error {
            req.Header.Add("X-Amzn-Requestid", uuid.New().String()) //tracking requests
            err = sellingPartner.SignRequest(req)
            if err != nil {
                return errors.Wrap(err, "sign error")
            }
            dump, err := httputil.DumpRequest(req, true)
            if err != nil {
                return errors.Wrap(err, "DumpRequest Error")
            }
            log.Printf("DumpRequest = %s", dump)
            return nil
        }),
        merchantFulfillment.WithResponseAfter(func(ctx context.Context, rsp *http.Response) error {
            dump, err := httputil.DumpResponse(rsp, true)
            if err != nil {
                return errors.Wrap(err, "DumpResponse Error")
            }
            log.Printf("DumpResponse = %s", dump)
            return nil
        }),
    )

    if err != nil {
        panic(err)
    }

    ctx := context.Background()
    //_, err = seller.GetMarketplaceParticipationsWithResponse(ctx)
    _, err = client.GetShipment(ctx, "TBA179854")
    if err != nil {
        panic(err)
    }
}

If I run the above code, I get:

        status code: 403, request id: d95b6f8a-0cfd-4d21-b16f-5657534e8718

Again, I reached out to support but you deactivated my account even after I paid $40.

gopkg-dev commented 3 years ago

Please check if your Region and endpoint correspond.

https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#selling-partner-api-endpoints

github-actions[bot] commented 2 years ago

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.