Skip to content

Commit 836fa40

Browse files
authored
Merge pull request #558 from mbradley672/melvin/HTTP_proxy_sample_code_and_documentation
Proxy/GetOrderAddress sample code and documentation
2 parents 5525731 + 74096a8 commit 836fa40

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ For more information about keys please check [New Amazon doc for create keys Dev
9797
---
9898
## Usage
9999

100+
> ### Please be aware there has been a change to the _Orders.GetOrderAddress()_ method please reference the new sample code for more details.
101+
100102
### Configuration
103+
You can configure a connection like so please see [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/Program.cs) for the relevant code file.
101104
```CSharp
102105
AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
103106
{
@@ -125,6 +128,25 @@ AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
125128

126129
```
127130

131+
### Configuration using a proxy
132+
Please see [here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/Program.cs) for the relevant code file.
133+
>```csharp
134+
>AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
135+
>{
136+
> AccessKey = "AKIAXXXXXXXXXXXXXXX",
137+
> SecretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
138+
> RoleArn = "arn:aws:iam::XXXXXXXXXXXXX:role/XXXXXXXXXXXX",
139+
> ClientId = "amzn1.application-XXX-client.XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
140+
> ClientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
141+
> RefreshToken= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
142+
> MarketPlaceID = "A2VIGQ35RCS4UG",
143+
> ProxyAddress = "http(s)://xxx.xxx.xxx.xxx:xxxx",
144+
>});
145+
>```
146+
>> * Assign your proxy address to the ProxyAddress Property and you'll be able to use a proxy account.
147+
>>
148+
>> ***This is not required and will operate normally without the ProxyAddress being set.***
149+
128150
### Order List, For more orders sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/ReportsSample.cs).
129151
```CSharp
130152
ParameterOrderList serachOrderList = new ParameterOrderList();

Source/FikaAmazonAPI.SampleCode/OrdersSample.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ public void GetOrderBuyerInfo()
102102

103103
public void GetOrderAddress()
104104
{
105+
// This method has been changed and is a breaking change
106+
// If you would like the default behavior please reference the
107+
// ShippingAddress variable
105108
var Address = amazonConnection.Orders.GetOrderAddress("402-0467973-4229120");
109+
var BuyerCompanyName = Address.BuyerCompanyName;
110+
var ShippingAddress = Address.ShippingAddress;
111+
var DeliveryPreferences = Address.DeliveryPreferences;
106112
}
107113

108114

Source/FikaAmazonAPI.SampleCode/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ static async Task Main(string[] args)
2727
SellerID = config.GetSection("FikaAmazonAPI:SellerId").Value,
2828
IsDebugMode = true
2929
});
30+
31+
AmazonConnection amazonConnectionUsingAProxy = new AmazonConnection(new AmazonCredential()
32+
{
33+
AccessKey = config.GetSection("FikaAmazonAPI:AccessKey").Value,
34+
SecretKey = config.GetSection("FikaAmazonAPI:SecretKey").Value,
35+
RoleArn = config.GetSection("FikaAmazonAPI:RoleArn").Value,
36+
ClientId = config.GetSection("FikaAmazonAPI:ClientId").Value,
37+
ClientSecret = config.GetSection("FikaAmazonAPI:ClientSecret").Value,
38+
RefreshToken = config.GetSection("FikaAmazonAPI:RefreshToken").Value,
39+
MarketPlaceID = config.GetSection("FikaAmazonAPI:MarketPlaceID").Value,
40+
SellerID = config.GetSection("FikaAmazonAPI:SellerId").Value,
41+
IsDebugMode = true,
42+
ProxyAddress = config.GetSection("FikaAmazonAPI:ProxyAddress").Value,
43+
});
3044

3145
var search = amazonConnection.ProductType.SearchDefinitionsProductTypes(new Parameter.ProductTypes.SearchDefinitionsProductTypesParameter
3246
{

Source/FikaAmazonAPI.SampleCode/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"ClientId": "amzn1.application-oa2-client.0000000000000000000000000000",
77
"ClientSecret": "000000000000000000000000000000000000",
88
"RefreshToken": "Atzr|00000000000000000000000000000000000000000000",
9-
"MarketPlaceID": "A2VIGQ35RCS4UG"
9+
"MarketPlaceID": "A2VIGQ35RCS4UG",
10+
"ProxyAddress": "http://localhost:8080",
1011
}
1112
}

0 commit comments

Comments
 (0)