public string InvokeListOrderItems(string OrderId) { try { Console.WriteLine("Starting {0} at {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, DateTime.Now); // Create a request. ListOrderItemsRequest request = new ListOrderItemsRequest(); request.SellerId = api.SellerId; request.MWSAuthToken = api.MWSAuthToken; request.AmazonOrderId = OrderId; response = client.ListOrderItems(request); Console.WriteLine("Response:"); rhmd = response.ResponseHeaderMetadata; // Is recommended logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); return(responseXml); } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } }
public static void GetOrders() { // TODO: Set the below configuration variables before attempting to run // Developer AWS access key string accessKey = "AKIAJHVFTQFZLBA42KEA"; // Developer AWS secret key string secretKey = "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"; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws.amazonservices.com"; // Create a configuration object MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself Operations.Orders.MarketplaceWebServiceOrders client = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config); MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeGetOrder(); // response = sample.InvokeGetServiceStatus(); // response = sample.InvokeListOrderItems(); // response = sample.InvokeListOrderItemsByNextToken(); response = sample.InvokeListOrders(); // response = sample.InvokeListOrdersByNextToken(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } }
private static XmlDocument getListOrdersByDateTimeXmlData(ServiceCliamDefinition serviceCliamDefinition, DateTime createdAfterDateTime, DateTime createdBeforeDateTime) { IMWSResponse listOrdersResponse = null; listOrdersResponse = MarketplaceWebServiceOrdersEntity.InvokeListOrdersByDateTime(serviceCliamDefinition, createdAfterDateTime, createdBeforeDateTime); string responseXml = listOrdersResponse.ToXML(); XmlDocument xOrderList = new XmlDocument(); xOrderList.LoadXml(responseXml); return(xOrderList); }
public static void Main(string[] args) { // TODO: Set the below configuration variables before attempting to run // Create a configuration object MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself MarketplaceWebServiceOrders client = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config); MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; //response = sample.InvokeGetOrder(); // response = sample.InvokeGetServiceStatus(); // response = sample.InvokeListOrderItems(); // response = sample.InvokeListOrderItemsByNextToken(); response = sample.InvokeListOrders(); // response = sample.InvokeListOrdersByNextToken(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MarketplaceWebServiceOrdersException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
private static XmlDocument GetListOrderItemsXmlData(ServiceCliamDefinition serviceCliamDefinition, string orderId) { IMWSResponse OrderResponse = null; OrderResponse = MarketplaceWebServiceOrdersEntity.InvokeListOrderItems(serviceCliamDefinition, orderId); string orderResponesXML = OrderResponse.ToXML(); XmlDocument xOrderList = new XmlDocument(); xOrderList.LoadXml(orderResponesXML); return(xOrderList); }
public static DataSet ListAmazonOrderLineByNextToken(string accountName, string token, string merchantId, string marketplaceId, string accessKeyId, string secretAccessKey) { DataSet amazonOrderLineListDs = new DataSet(); const string applicationName = "<Your Application Name>"; const string applicationVersion = "<Your Application Version>"; ListOrderItemsByNextTokenRequest request = new ListOrderItemsByNextTokenRequest(); string sellerId = merchantId; request.SellerId = sellerId; request.NextToken = token; MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig(); config.ServiceURL = "https://mws.amazonservices.com"; MarketplaceWebServiceOrdersClient client = new MarketplaceWebServiceOrdersClient(accessKeyId, secretAccessKey, applicationName, applicationVersion, config); try { IMWSResponse response = null; response = client.ListOrderItemsByNextToken(request); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); System.IO.File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\AmazonOrderLineList.xml", responseXml); amazonOrderLineListDs.ReadXml(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\AmazonOrderLineList.xml", XmlReadMode.InferSchema); return(amazonOrderLineListDs); } catch (MarketplaceWebServiceOrdersException ex) { ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; //Console.WriteLine("Service Exception:"); //if (rhmd != null) //{ // Console.WriteLine("RequestId: " + rhmd.RequestId); // Console.WriteLine("Timestamp: " + rhmd.Timestamp); //} //Console.WriteLine("Message: " + ex.Message); //Console.WriteLine("StatusCode: " + ex.StatusCode); //Console.WriteLine("ErrorCode: " + ex.ErrorCode); //Console.WriteLine("ErrorType: " + ex.ErrorType); ExceptionUtility exceptionUtility = new ExceptionUtility(); exceptionUtility.ErrorWarningMethod("Amazon List Next Order Line Service Exception: " + accountName, "Message: " + ex.Message, senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum); return(amazonOrderLineListDs); } catch (Exception ex) { ExceptionUtility exceptionUtility = new ExceptionUtility(); exceptionUtility.ErrorWarningMethod("Amazon List Next Order Line Code General Error: " + accountName, "ex: " + ex.Message, senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum); return(amazonOrderLineListDs); } }
public static DataSet ListAmazonOrderLine(string amazonOrderid, string merchantId, string marketplaceId, string accessKeyId, string secretAccessKey) { DataSet amazonOrderLineDs = new DataSet(); const string applicationName = "<Your Application Name>"; const string applicationVersion = "<Your Application Version>"; ListOrderItemsRequest request = new ListOrderItemsRequest(); string sellerId = merchantId; request.SellerId = sellerId; request.AmazonOrderId = amazonOrderid; MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig(); config.ServiceURL = "https://mws.amazonservices.com"; MarketplaceWebServiceOrdersClient client = new MarketplaceWebServiceOrdersClient(accessKeyId, secretAccessKey, applicationName, applicationVersion, config); try { IMWSResponse response = null; response = client.ListOrderItems(request); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); System.IO.File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\AmazonOrderLineList.xml", responseXml); amazonOrderLineDs.ReadXml(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\AmazonOrderLineList.xml", XmlReadMode.InferSchema); return(amazonOrderLineDs); } catch (MarketplaceWebServiceOrdersException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
public APIResults(IMWSResponse response, MwsException ex, bool success) { MWSClientCsRuntime.MwsResponseHeaderMetadata rhmd; Success = success; if (Success) { rhmd = response.ResponseHeaderMetadata; RequestId = rhmd.RequestId; Timestamp = rhmd.Timestamp; ResponseXml = response.ToXML(); } else { rhmd = ex.ResponseHeaderMetadata; RequestId = rhmd.RequestId; Timestamp = rhmd.Timestamp; ExMessage = ex.Message; ExStatusCode = ex.StatusCode; ExErrorCode = ex.ErrorCode; ExErrorType = ex.ErrorType; } }
public string InvokeListOrders(DateTime createdAfter, DateTime createdBefore) { try { Console.WriteLine("Starting {0} at {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, DateTime.Now); // Create a request. ListOrdersRequest request = new ListOrdersRequest(); request.SellerId = api.SellerId; request.MWSAuthToken = api.MWSAuthToken; request.CreatedAfter = createdAfter; request.CreatedBefore = createdBefore; request.OrderStatus = new List <string>() { "Unshipped", "PartiallyShipped" }; request.MarketplaceId.Add(api.MarketplaceId); request.FulfillmentChannel = new List <string>() { "MFN" }; request.MaxResultsPerPage = 100; request.TFMShipmentStatus = new List <string>(); response = client.ListOrders(request); Console.WriteLine("Response:"); rhmd = response.ResponseHeaderMetadata; // Is recommended logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); return(responseXml); } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } }
public static void Main(string[] args) { var chain = new CredentialProfileStoreChain(); AWSCredentials awsCredentials; chain.TryGetAWSCredentials("DD MWS", out awsCredentials); var creds = awsCredentials.GetCredentials(); // Developer AWS access key string accessKey = creds.AccessKey; // Developer AWS secret key string secretKey = creds.SecretKey; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; string sellerId = "ARA1ZW7ZHL5MQ"; string marketplaceId = "ATVPDKIKX0DER"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws.amazonservices.com"; // Create a configuration object MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(accessKey, secretKey, appName, appVersion, config); MWSSubscriptionsServiceSample sample = new MWSSubscriptionsServiceSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeCreateSubscription(); response = sample.InvokeDeleteSubscription(); // succesfully called //response = sample.InvokeRegisterDestination(); //RegisterDestinationResponse registerDestinationResponse = (RegisterDestinationResponse)response; //response = sample.InvokeCreateSubscription(); //CreateSubscriptionResponse createSubscriptionResponse = (CreateSubscriptionResponse)response; // response = sample.InvokeGetSubscription(); //response = sample.InvokeListRegisteredDestinations(); //response = sample.InvokeListSubscriptions(); response = sample.InvokeRegisterDestination(); //response = sample.InvokeSendTestNotificationToDestination(); // response = sample.InvokeUpdateSubscription(); // response = sample.InvokeGetServiceStatus(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MWSSubscriptionsServiceException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
public static void Main2(string[] args) { // TODO: Set the below configuration variables before attempting to run // Developer AWS access key string accessKey = "replaceWithAccessKey"; // Developer AWS secret key string secretKey = "replaceWithSecretKey"; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "replaceWithServiceURL"; // Create a configuration object MWSCustomerServiceConfig config = new MWSCustomerServiceConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself IMwsCustomerService client = new MWSCustomerServiceClient(accessKey, secretKey, appName, appVersion, config); MWSCustomerServiceSample sample = new MWSCustomerServiceSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeGetCustomersByCustomerId(); // response = sample.InvokeGetCustomersForCustomerId(); // response = sample.InvokeListCustomers(); // response = sample.InvokeListCustomersByNextToken(); // response = sample.InvokeGetServiceStatus(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MWSCustomerServiceException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
public void RunTest() { // TODO: Set the below configuration variables before attempting to run // Developer AWS access key string accessKey = "AKIAJZY7ZVPLTWQYHWYA"; // Developer AWS secret key string secretKey = "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"; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws.amazonservices.com"; // Create a configuration object MarketplaceWebServiceProductsConfig config = new MarketplaceWebServiceProductsConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself MarketplaceWebServiceProductsClient client = new MarketplaceWebServiceProductsClient(appName, appVersion, accessKey, secretKey, config); this.client = client; // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeGetCompetitivePricingForASIN(); // response = sample.InvokeGetCompetitivePricingForSKU(); // response = sample.InvokeGetLowestOfferListingsForASIN(); // response = sample.InvokeGetLowestOfferListingsForSKU(); // response = sample.InvokeGetLowestPricedOffersForASIN(); // response = sample.InvokeGetLowestPricedOffersForSKU(); // response = sample.InvokeGetMatchingProduct(); // response = sample.InvokeGetMatchingProductForId(); // response = sample.InvokeGetMyFeesEstimate(); response = InvokeGetMyPriceForASIN(); // response = sample.InvokeGetMyPriceForSKU(); // response = sample.InvokeGetProductCategoriesForASIN(); // response = sample.InvokeGetProductCategoriesForSKU(); // response = sample.InvokeGetServiceStatus(); // response = sample.InvokeListMatchingProducts(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MarketplaceWebServiceProductsException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
// GET: Amazon public ActionResult Index() { // Developer AWS access key string accessKey = "AKIAJO3IC7VKEKZOPUZQ"; // Developer AWS secret key string secretKey = "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"; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws-eu.amazonservices.com"; // Create a configuration object MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself MarketplaceWebServiceOrdersClient client = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config); MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeGetOrder(); // response = sample.InvokeGetServiceStatus(); // response = sample.InvokeListOrderItems(); // response = sample.InvokeListOrderItemsByNextToken(); response = sample.InvokeListOrders(); // response = sample.InvokeListOrdersByNextToken(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MarketplaceWebServiceOrdersException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } return(View()); }
public static void Main(string[] args) { var chain = new CredentialProfileStoreChain(); AWSCredentials awsCredentials; chain.TryGetAWSCredentials("RedCarpet MWS", out awsCredentials); var creds = awsCredentials.GetCredentials(); // Developer AWS access key string accessKey = creds.AccessKey; // Developer AWS secret key string secretKey = creds.SecretKey; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws.amazonservices.com"; // Create a configuration object MarketplaceWebServiceProductsConfig config = new MarketplaceWebServiceProductsConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself IMarketplaceWebServiceProducts client = new MarketplaceWebServiceProductsClient(appName, appVersion, accessKey, secretKey, config); MarketplaceWebServiceProductsSample sample = new MarketplaceWebServiceProductsSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; //response = sample.InvokeGetCompetitivePricingForASIN(); // response = sample.InvokeGetCompetitivePricingForSKU(); // response = sample.InvokeGetLowestOfferListingsForASIN(); // response = sample.InvokeGetLowestOfferListingsForSKU(); // response = sample.InvokeGetLowestPricedOffersForASIN(); // response = sample.InvokeGetLowestPricedOffersForSKU(); // response = sample.InvokeGetMatchingProduct(); // response = sample.InvokeGetMatchingProductForId(); response = sample.InvokeGetMyFeesEstimate(); // response = sample.InvokeGetMyPriceForASIN(); // response = sample.InvokeGetMyPriceForSKU(); // response = sample.InvokeGetProductCategoriesForASIN(); // response = sample.InvokeGetProductCategoriesForSKU(); // response = sample.InvokeGetServiceStatus(); // response = sample.InvokeListMatchingProducts(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MarketplaceWebServiceProductsException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if(rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
public static void Main(string[] args) { // TODO: Set the below configuration variables before attempting to run // Developer AWS access key string accessKey = "AKIAJTIETNNID4BMNRTA"; // Developer AWS secret key string secretKey = "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"; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws.amazonservices.com"; // Create a configuration object MarketplaceWebServiceSellersConfig config = new MarketplaceWebServiceSellersConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself Claytondus.AmazonMWS.Sellers.MarketplaceWebServiceSellers client = new MarketplaceWebServiceSellersClient(appName, appVersion, accessKey, secretKey, config); MarketplaceWebServiceSellersSample sample = new MarketplaceWebServiceSellersSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeGetServiceStatus(); response = sample.InvokeListMarketplaceParticipations(); // response = sample.InvokeListMarketplaceParticipationsByNextToken(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MarketplaceWebServiceSellersException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
public static void Main(string[] args) { // TODO: Set the below configuration variables before attempting to run // Developer AWS access key string accessKey = ""; // Developer AWS secret key string secretKey = ""; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws.amazonservices.com"; // Create a configuration object FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself FBAInboundServiceMWS client = new FBAInboundServiceMWSClient(accessKey, secretKey, appName, appVersion, config); FBAInboundServiceMWSSample sample = new FBAInboundServiceMWSSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeConfirmPreorder(); // response = sample.InvokeConfirmTransportRequest(); // response = sample.InvokeCreateInboundShipment(); // response = sample.InvokeCreateInboundShipmentPlan(); // response = sample.InvokeEstimateTransportRequest(); // response = sample.InvokeGetBillOfLading(); // response = sample.InvokeGetInboundGuidanceForASIN(); // response = sample.InvokeGetInboundGuidanceForSKU(); // response = sample.InvokeGetPackageLabels(); // response = sample.InvokeGetPalletLabels(); // response = sample.InvokeGetPreorderInfo(); // response = sample.InvokeGetPrepInstructionsForASIN(); // response = sample.InvokeGetPrepInstructionsForSKU(); response = sample.InvokeGetServiceStatus(); // response = sample.InvokeGetTransportContent(); // response = sample.InvokeGetUniquePackageLabels(); // response = sample.InvokeListInboundShipmentItems(); // response = sample.InvokeListInboundShipmentItemsByNextToken(); // response = sample.InvokeListInboundShipments(); // response = sample.InvokeListInboundShipmentsByNextToken(); // response = sample.InvokePutTransportContent(); // response = sample.InvokeUpdateInboundShipment(); // response = sample.InvokeVoidTransportRequest(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (FBAInboundServiceMWSException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
public static DataSet ListAmazonOrderHeader(string accountName, string merchantId, string marketplaceId, string accessKeyId, string secretAccessKey) { DataSet amazonOrderHeaderListDs = new DataSet(); const string applicationName = "<Your Application Name>"; const string applicationVersion = "<Your Application Version>"; ListOrdersRequest request = new ListOrdersRequest(); string sellerId = merchantId; request.SellerId = sellerId; DateTime createdAfter = System.DateTime.Now.AddDays(-15); request.CreatedAfter = createdAfter; List <string> orderStatusList = new List <string>(); orderStatusList.Add("Unshipped"); orderStatusList.Add("PartiallyShipped"); //orderStatusList.Add("Shipped"); //orderStatusList.Add("Pending"); //orderStatusList.Add("Canceled"); request.OrderStatus = orderStatusList; List <string> marketplaceIdList = new List <string>(); marketplaceIdList.Add(marketplaceId); request.MarketplaceId = marketplaceIdList; MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig(); config.ServiceURL = "https://mws.amazonservices.com"; MarketplaceWebServiceOrdersClient client = new MarketplaceWebServiceOrdersClient(accessKeyId, secretAccessKey, applicationName, applicationVersion, config); //MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(client); try { IMWSResponse response = null; response = client.ListOrders(request); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; string responseXml = response.ToXML(); System.IO.File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\AmazonOrderHeaderList.xml", responseXml); amazonOrderHeaderListDs.ReadXml(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\AmazonOrderHeaderList.xml", XmlReadMode.InferSchema); return(amazonOrderHeaderListDs); } catch (MarketplaceWebServiceOrdersException ex) { ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; //Console.WriteLine("Service Exception:"); //if (rhmd != null) //{ // Console.WriteLine("RequestId: " + rhmd.RequestId); // Console.WriteLine("Timestamp: " + rhmd.Timestamp); //} //Console.WriteLine("Message: " + ex.Message); //Console.WriteLine("StatusCode: " + ex.StatusCode); //Console.WriteLine("ErrorCode: " + ex.ErrorCode); //Console.WriteLine("ErrorType: " + ex.ErrorType); ExceptionUtility exceptionUtility = new ExceptionUtility(); exceptionUtility.ErrorWarningMethod("Amazon List Order Header Service Exception: " + accountName, "Message: " + ex.Message, senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum); return(amazonOrderHeaderListDs); } catch (Exception ex) { ExceptionUtility exceptionUtility = new ExceptionUtility(); exceptionUtility.ErrorWarningMethod("Amazon List Order Header Code General Error: " + accountName, "ex: " + ex.Message, senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum); return(amazonOrderHeaderListDs); } }