对接亚马逊 ads api( Amazon Advertising API) 第一章:申请授权

您所在的位置:网站首页 亚马逊卖家云服务器配置错误 对接亚马逊 ads api( Amazon Advertising API) 第一章:申请授权

对接亚马逊 ads api( Amazon Advertising API) 第一章:申请授权

2024-07-11 22:11| 来源: 网络整理| 查看: 265

目录

1、申请亚马逊开发者账号

1.1、登录/注册,进入页面,并点击右上角的登录

1.2、登录或者注册亚马逊开发者账号

1.3、新建security profile

1.3.1、在菜单栏找到 login with Amazon

1.3.2、create a new security profile

1.3.3、填写相关资料

1.3.4、保存成功后将会回到 login with Amazon 页面

1.3.5、回到亚马逊广告API的首页,填写右侧的相关信息

1.3.6、提交之后会有邮件通知你是否完成注册

2、创建 API 授权并且刷新令牌(Create API authorization and refresh tokens)

2.1、创建 authorization code

2.1.1、根据地区选择url

2.1.2、参数配置

2.1.3、进入2.1.2拼接的url,你就会被要求登录。这里会有两种情况

2.1.4、允许之后将会重定向到一个新的url。将当前的url里面的 code 参数保存下来。

2.2、Call the authorization URL to request authorization and refresh tokens

2.2.1、选择和2.1.1相同区域的url。

2.2.2、参数配置

2.2.3、请求header

2.2.4、请求token

2.2.5、返回栗子

2.2.6、刷新token

如有不对的地方,欢迎指出。共勉~!

问题集锦

Java 对接亚马逊广告API接口(Amazon AWS API) 第二章:沙盒测试

亚马逊广告官网: Amazon Advertising Advanced Tools Center

1、申请亚马逊开发者账号

官网教程: Amazon Advertising Advanced Tools Center

登录Amazon的常见问题(FAQ): Login with Amazon frequently asked questions (FAQ).

1.1、登录/注册,进入页面,并点击右上角的登录

亚马逊开发人员服务

1.2、登录或者注册亚马逊开发者账号

如果是注册账号。创建了一个新帐户之后,您将被重定向到开发人员注册页面。

1.3、新建security profile 1.3.1、在菜单栏找到 login with Amazon

1.3.2、create a new security profile

1.3.3、填写相关资料

1.3.4、保存成功后将会回到 login with Amazon 页面

这个页面将会显示security profile name 和 OAuth2 credentials 。

OAuth2 credentials 包含 client ID 和 client secret。将这两个信息保存起来。后面生成 token 的时候会用到。

1.3.5、回到亚马逊广告API的首页,填写右侧的相关信息

API | 亚马逊广告

====================== 注意要点 ====================================

1、在请描述计划的解决方案和功能(Comments)中可以指定

Data ProviderDSP需求方平台Sponsored Display展示推广Sponsored Brands品牌推广Sponsored Products商品推广

If you are a direct advertiser, please submit your account type (ie. Seller, Vendor) and your merchant token or entity ID

如果您是直接广告主,请提交您的账户类型(即卖家、供应商)和您的卖家令牌或实体 ID

可以直接提供上述的相关信息,就不用管表单中的参数了。

2、What do you plan to manage with the API?

因为需要下载 Sponsored Products 的费用报告,所以这个地方要选择 Advertising API

==============================================================

1.3.6、提交之后会有邮件通知你是否完成注册

我们需要回答相关的问题完成注册。

1.3.6.1、第一封邮件。

Thanks for your interest in the Advertising API. The API allows you to programmatically manage Sponsored Ads campaigns, ad groups, ads, keywords, bids, and budgets. In addition, detailed reporting allows you to pull performance data to analyze sales and investments. To proceed with your request please reply to the following questions. · How did you find out about the Amazon Advertising API · Are you using Sponsored Ads already? · Are you a seller or a vendor or a third party managing sellers or vendors? · What solution are you trying to build/what process are you trying to automate? · What is the target audience for your solution (e.g. are you planning to build an in-house solution to manage your Amazon Advertising campaigns? Do you plan to make the solution available to others?) Best regards, The Advertising API-Team

1.3.6.2、第二封邮件。

Thank you for providing more details about your request. Could you please elaborate or provide us a detailed description of the solution you are trying to build? This would help us to provide the best possible support. Best Regards, The Advertising API-Team

1.3.6.3、第三封邮件

大致是要求公司名、公司官网和邮箱必须使用相同的域名。

Hi,

Thanks for your interest in the Advertising API.

During registration, you provided a company name (XXXXXXXXXXX) that does not match your email domain ([email protected]) or/ and website domain (www.amazon.com/shops/XXXXXXXX). We require consistent details (Company name, Email and Website URL) in order to proceed with your request.

Can you please provide us consistent details? For example, if your company name is “ABC”, then website has to be “ABC.com” then email has to be [email protected]

This information will help us to provide best possible support.

Best Regards,

The Advertising API-Team

==================== 2021-02-20 补充 ==========================

关于这个域名的问题。我是用中国公司去申请的,所以来回了多次这个问题的邮件。最终通过美国商标网证明了我公司是我公司。

==============================================================

1.3.6.4、第四封邮件

会让我们选择即将使用的类型

Thanks for your interest in the Amazon Advertising API.​

Can you please specify which solution you are trying to build using our Advertising API?

Advertising API to manage Sponsored Ads: Amazon Advertising Advanced Tools CenterData Provider API: Amazon Advertising Advanced Tools CenterDSP Reporting API: Amazon Advertising Advanced Tools Center

Best Regards, The Advertising API Team​​​

1.3.6.5、第五封邮件

这一步似乎和Amazon Advertising Advanced Tools Center是一样的(即帐号使用的区域有哪些)。我们将NA, EU, and FE 这三个都回复过去即可。

Thanks for your interest in the Advertising API.

Which advertisers, in which regions, are requesting that you integrate with Amazon Advertising API for data providers? Are these existing Amazon DSP advertisers?

This information helps to provide the best possible support.

Best Regards, The Advertising API Team​​​

1.3.6.6、第六封邮件

至此我们就已经通过了邮件的考验!

We are excited to invite you to use the Amazon Advertising API! 

To get started, please do the following:

1.Make sure your developers or your technical team have read the Getting Started Guide and are aware of the API reference, which they will require to develop your integration.   2.As a first step, you will need to sign in to an existing Amazon Developer account or you can register a new account if you haven’t already done so. Please make sure to use this account for accessing the Amazon Advertising API. Ø  To do this make sure to select “Sign In” in the top right hand corner of the website. There you can sign in with your existing account or create a new one.

3.Before you can register your application, you need to agree to the Amazon Advertising Data Provider agreement and to the Amazon Advertising API License Agreement found here.    4.Once you have accepted the license agreement, select the application you wish to use to access the Amazon Advertising API.   A support account will be created for the email address used for this API invitation. Please reply to this email with the name and email address for any additional contacts who need an API support account. Registered accounts will receive direct alerts for issues impacting the API service and notification of product releases and features.

Please use your JIRA support account if you have any further questions/concerns with any of the above steps.

As a last step, we kindly ask you to fill out our feedback survey here to improve upon the API onboarding experience.

 点击第三步链接后会出现下面的页面,至此帐号授权完成。

Bug

 当你复制链接的时候,会发现链接长这样,OCID是空的。

https://advertising-api.amazon.com/apim/logIn?state={{OCID}}&locale=en_US

 

解决方法(Nowbe 提供)

将 OCID 替换成【卖家店铺ID】。

如果还不行,回邮件给亚马逊,说这个链接不行。他们会给你一个新的~

2、创建 API 授权并且刷新令牌(Create API authorization and refresh tokens)

官方教程: Amazon Advertising Advanced Tools Center

授权基于OAuth 2.0的规则

AudienceDescriptionAdvertiserA Seller Central or Amazon Advertising Console user that can create and manage advertising campaigns.Advertising API DeveloperThe owner of a Login with Amazon account that makes calls to the Amazon Advertising API directly, typically on behalf of an advertiser. An API developer typically requires permission - granted using Login with Amazon - from an advertiser to create and manage campaigns. 2.1、创建 authorization code 2.1.1、根据地区选择url RegionURL prefixNorth America (NA)https://www.amazon.com/ap/oaEurope (EU)https://eu.account.amazon.com/ap/oaFar East (FE)https://apac.account.amazon.com/ap/oa 2.1.2、参数配置 ParameterDescriptionclient_idThe Client ID value that you retrieved in the prerequisites section of this document.scopeThe OAuth 2.0 permission scope used to limit the application's access to an advertiser's account. For the Sponsored Brands, Sponsored Display, and Sponsored Products APIs, set scope to cpc_advertising:campaign_management. For the Data Provider API, set scope to advertising::audiences. For the DSP API, set scope to advertising::campaign_management.response_typeThe type of response. Always set to code.redirect_uriThe value from the Allowed Return URLs field, retrieved in the prerequisites section of this document.

e.g.以北美举例。

https://www.amazon.com/ap/oa?client_id= YOUR_LWA_CLIENT_ID&scope= advertising::campaign_management&response_type=code&redirect_uri= YOUR_RETURN_URL

============================ 注意要点 ===========================

这个链接相当于帐号授权了。我们需要到亚马逊后台去请求这个链接。一旦同意即完成亚马逊帐号对开发者帐号的授权。

注意:不要用你的 develop account 去登录通过授权,而是用 amazon account 去授权。

==================================================================

2.1.3、进入2.1.2拼接的url,你就会被要求登录。这里会有两种情况 非Data Provider API使用你在 Login with Amazon 中注册的帐号Data Provider API使用你在additional setup steps for the Data Provider API中按不同区域申请的帐号。并且使用和当期url 相同区域的帐号登录

登录之后,直接点击允许(Allow)即可。

==================== 2020-08-12 添加 ==========================

拼接完成后请求出现这个bug。这是我们还没有通过亚马逊API申请。

============================================================

==================== 2021-02-20 添加 ==========================

通过邮件之后,再次测试。然而还是报错了... 但是这个bug还是很好处理的,只需要在对应位置添加上对应的回调URL就可以了。

在 Login With Amazon 里找到 web 设置,填上你的redirect_uri即可。可以填写亚马逊官网

============================================================

2.1.4、允许之后将会重定向到一个新的url。将当前的url里面的 code 参数保存下来。

Amazon.com

2.2、Call the authorization URL to request authorization and refresh tokens 2.2.1、选择和2.1.1相同区域的url。 RegionAuthorization URLNorth America (NA)https://api.amazon.com/auth/o2/tokenEurope (EU)https://api.amazon.co.uk/auth/o2/tokenFar East (FE)https://api.amazon.co.jp/auth/o2/token 2.2.2、参数配置 ParameterDescriptiongrant_typeMust be authorization_code.codeThe authorization code retrieved in 2.1.4.redirect_uriOne of the values from the consent privacy notice URL field. Recall that you retrieved this value in the prerequisites section of this document.client_idThe Client ID value that you retrieved in the prerequisites section of this document.client_secretThe Client Secret value that you retrieved in the prerequisites section of this document. 2.2.3、请求header Content-Type:application/x-www-form-urlencoded

charset=UTF-8

2.2.4、请求token

curl  \     -X POST \     -H "Content-Type:application/x-www-form-urlencoded;charset=UTF-8" \     --data "grant_type=authorization_code&code=AUTH_CODE&redirect_uri=YOUR_RETURN_URL&client_id=YOUR_CLIENT_ID&client_secret=YOUR_SECRET_KEY" \     https://api.amazon.com/auth/o2/token

2.2.5、返回栗子 { "access_token": "", "refresh_token": "", "token_type": "bearer", "expires_in": 3600 } FieldDescriptionaccess_tokenThe authorization token.refresh_tokenThe refresh token.token_typeThe type of OAuth 2.0 token. Always set to bearer.expires_inThe length of time until the authorization token expires, in seconds. token过期时间(秒)

Postman 测试

2.2.6、刷新token

curl \                                                                                                                                                             -X POST \     -H "Content-Type:application/x-www-form-urlencoded;charset=UTF-8" \     --data "grant_type=refresh_token&client_id=YOUR_CLIENT_ID&refresh_token=YOUR_REFRESH_TOKEN&client_secret=YOUR_CLIENT_SECRET" \     https://api.amazon.com/auth/o2/token

Postman 测试

那么至此申请授权方面就已经完成了。接下来我会写第二章测试具体的API。

如有不对的地方,欢迎指出。共勉~!

问题集锦 问题答案亚马逊 MWS和AWS 开发者帐号是否通用不通用,需要分别申请。多个亚马逊卖家店铺是否需要申请多个开发者帐号只需要申请一个,其他的通过授权即可。不同区域可通过不同的api区分区域。

Java 对接亚马逊广告API接口(Amazon AWS API) 第二章:沙盒测试



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3