{"_id":"57dc5a44de08c819002a165b","__v":0,"category":{"_id":"54cc2149380ecd0d00ca18b3","project":"5436a1e1d0ffee0e00f18f8c","version":"54cc2148380ecd0d00ca18aa","__v":4,"pages":["54cc2149380ecd0d00ca18b8","54cfa9ebbba1a0230087417e","54cfb63b3995cf0d0006f6de","55b40c415e6f140d0088fd71"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-31T17:07:44.342Z","from_sync":false,"order":8,"slug":"net-client","title":".Net Client"},"parentDoc":null,"version":{"_id":"54cc2148380ecd0d00ca18aa","__v":2,"forked_from":"5436a1e1d0ffee0e00f18f8f","project":"5436a1e1d0ffee0e00f18f8c","createdAt":"2015-01-31T00:26:48.753Z","releaseDate":"2015-01-31T00:26:48.753Z","categories":["54cc2149380ecd0d00ca18ab","54cc2149380ecd0d00ca18ac","54cc2149380ecd0d00ca18ad","54cc2149380ecd0d00ca18ae","54cc2149380ecd0d00ca18af","54cc2149380ecd0d00ca18b0","54cc2149380ecd0d00ca18b1","54cc2149380ecd0d00ca18b2","54cc2149380ecd0d00ca18b3","552f29ca633a5b0d00e99d09"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"project":"5436a1e1d0ffee0e00f18f8c","user":"5436a1afb7cf0e1c0020d9ca","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-16T20:47:00.767Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"To add an order to a store, first instantiate a new Client object with the ShippingEasy account's API key and API secret. Then use CreateOrder to specify the store's API key and the data for the order:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"using System;\\nusing System.Collections.Generic;\\nusing System.Linq;\\nusing System.Text;\\nusing System.Threading.Tasks;\\nusing ShippingEasy;\\n\\nnamespace ConsoleApplication1\\n{\\n    class Program\\n    {\\n        static void Main(string[] args)\\n        {\\n            String baseUrl = \\\"https://app.shippingeasy.com\\\";\\n\\n            // from Settings > API Credentials\\n            String apiKey = \\\"7e419816e705d1cd6d7d533bf484ad\\\";\\n            String apiSecret = \\\"3ca2e94bca001112f3a89e208dec55e89d630bbd33a0dcf591847cc5944d21\\\";\\n\\n            // from Settings > Stores\\n            String storeApiKey = \\\"d0e8e360d4a1d42a53eed5439150a8\\\";\\n\\n            var client = new Client(apiKey, apiSecret, baseUrl);\\n\\n            var result = client.CreateOrder(storeApiKey, new Order\\n                {\\n                    ExternalOrderIdentifier = \\\"ABC1234\\\",\\n                    OrderedAt = DateTime.Now,\\n                    Recipients =\\n                    {\\n                        new Recipient\\n                        {\\n                            FirstName = \\\"Colin\\\",\\n                            LastName = \\\"Smith\\\",\\n                            Address = \\\"1600 Pennsylvania Ave\\\",\\n                            City = \\\"Washington\\\",\\n                            State = \\\"DC\\\",\\n                            LineItems = {\\n                                new LineItem { ItemName = \\\"Sprocket\\\", Quantity = 7 }\\n                            }\\n                        }\\n                    },\\n                });\\n            HttpResponse response = result.HttpResponse;\\n        }\\n    }\\n}\\n\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nIf successful the call will return a JSON hash with the ShippingEasy order ID, as well as the external order identifier originally supplied in your call:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"order\\\": {\\n    \\\"id\\\": 58763481,\\n    \\\"external_order_identifier\\\": \\\"ABC12345\\\",\\n    \\\"ext_order_reference_id\\\": \\\"ABC12345\\\",\\n    \\\"owner_id\\\": 50385,\\n    \\\"ordered_at\\\": \\\"2016-09-16T20:52:13Z\\\",\\n    \\\"order_status\\\": \\\"ready_for_shipment\\\",\\n    \\\"parent_order_id\\\": null,\\n    \\\"source_order_ids\\\": null,\\n    \\\"total_including_tax\\\": \\\"0.00\\\",\\n    \\\"total_excluding_tax\\\": \\\"0.00\\\",\\n    \\\"discount_amount\\\": \\\"0.00\\\",\\n    \\\"coupon_discount\\\": \\\"0.00\\\",\\n    \\\"subtotal_including_tax\\\": \\\"0.00\\\",\\n    \\\"subtotal_excluding_tax\\\": \\\"0.00\\\",\\n    \\\"subtotal_tax\\\": \\\"0.00\\\",\\n    \\\"total_tax\\\": \\\"0.00\\\",\\n    \\\"base_shipping_cost\\\": \\\"0.00\\\",\\n    \\\"shipping_cost_including_tax\\\": \\\"0.00\\\",\\n    \\\"shipping_cost_excluding_tax\\\": \\\"0.00\\\",\\n    \\\"shipping_cost_tax\\\": \\\"0.00\\\",\\n    \\\"base_handling_cost\\\": \\\"0.00\\\",\\n    \\\"handling_cost_excluding_tax\\\": \\\"0.00\\\",\\n    \\\"handling_cost_including_tax\\\": \\\"0.00\\\",\\n    \\\"handling_cost_tax\\\": \\\"0.00\\\",\\n    \\\"base_wrapping_cost\\\": \\\"0.00\\\",\\n    \\\"wrapping_cost_excluding_tax\\\": \\\"0.00\\\",\\n    \\\"wrapping_cost_including_tax\\\": \\\"0.00\\\",\\n    \\\"wrapping_cost_tax\\\": \\\"0.00\\\",\\n    \\\"billing_company\\\": null,\\n    \\\"billing_first_name\\\": null,\\n    \\\"billing_last_name\\\": null,\\n    \\\"billing_address\\\": null,\\n    \\\"billing_address2\\\": null,\\n    \\\"billing_city\\\": null,\\n    \\\"billing_state\\\": null,\\n    \\\"billing_country\\\": null,\\n    \\\"billing_postal_code\\\": null,\\n    \\\"billing_phone_number\\\": null,\\n    \\\"billing_email\\\": null,\\n    \\\"recipients\\\": [\\n      {\\n        \\\"company\\\": null,\\n        \\\"first_name\\\": \\\"Colin\\\",\\n        \\\"last_name\\\": \\\"Smith\\\",\\n        \\\"address\\\": \\\"1600 Pennsylvania Ave\\\",\\n        \\\"address2\\\": null,\\n        \\\"address3\\\": null,\\n        \\\"city\\\": \\\"Washington\\\",\\n        \\\"residential\\\": null,\\n        \\\"state\\\": \\\"DC\\\",\\n        \\\"province\\\": null,\\n        \\\"country\\\": \\\"United States\\\",\\n        \\\"postal_code\\\": null,\\n        \\\"postal_code_plus_4\\\": null,\\n        \\\"phone_number\\\": null,\\n        \\\"email\\\": null,\\n        \\\"base_cost\\\": \\\"0.00\\\",\\n        \\\"cost_excluding_tax\\\": \\\"0.00\\\",\\n        \\\"cost_including_tax\\\": \\\"0.00\\\",\\n        \\\"cost_tax\\\": \\\"0.00\\\",\\n        \\\"base_handling_cost\\\": \\\"0.00\\\",\\n        \\\"handling_cost_excluding_tax\\\": \\\"0.00\\\",\\n        \\\"handling_cost_including_tax\\\": \\\"0.00\\\",\\n        \\\"handling_cost_tax\\\": \\\"0.00\\\",\\n        \\\"shipping_zone_id\\\": null,\\n        \\\"shipping_zone_name\\\": null,\\n        \\\"items_total\\\": 0,\\n        \\\"shipping_method\\\": null,\\n        \\\"items_shipped\\\": 0,\\n        \\\"ext_shipping_detail_id\\\": null,\\n        \\\"line_items\\\": [\\n          {\\n            \\\"item_name\\\": \\\"Sprocket\\\",\\n            \\\"sku\\\": null,\\n            \\\"bin_picking_number\\\": null,\\n            \\\"bundled_product\\\": null,\\n            \\\"weight_in_ounces\\\": \\\"0.0\\\",\\n            \\\"quantity\\\": 7,\\n            \\\"total_excluding_tax\\\": \\\"0.00\\\",\\n            \\\"price_excluding_tax\\\": \\\"0.00\\\",\\n            \\\"unit_price\\\": \\\"0.00\\\",\\n            \\\"ext_line_item_id\\\": null,\\n            \\\"ext_product_id\\\": null,\\n            \\\"product_options\\\": null,\\n            \\\"uuid\\\": \\\"70e9f2c7-7433-4ea2-8fcc-a3bb855b0298\\\",\\n            \\\"order_source_id\\\": 46993771,\\n            \\\"gift_message\\\": null\\n          }\\n        ],\\n        \\\"original_order\\\": {\\n          \\\"id\\\": 58763481,\\n          \\\"customer_id\\\": 3633,\\n          \\\"store_id\\\": 52377,\\n          \\\"order_detail_id\\\": 58842251,\\n          \\\"workflow_state\\\": \\\"ready_for_shipment\\\",\\n          \\\"shipment_id\\\": null,\\n          \\\"destination_id\\\": null,\\n          \\\"split_from_order_id\\\": null,\\n          \\\"total_weight_in_ounces\\\": \\\"0.0\\\",\\n          \\\"total_quantity\\\": 7,\\n          \\\"is_international\\\": false,\\n          \\\"usps_shipping_zone\\\": null,\\n          \\\"created_at\\\": \\\"2016-09-16T20:52:11Z\\\",\\n          \\\"updated_at\\\": \\\"2016-09-16T20:52:11Z\\\",\\n          \\\"ext_shipment_confirmation_id\\\": null,\\n          \\\"store_order_status\\\": \\\"awaiting_shipment\\\",\\n          \\\"drop_ship_tracking_number\\\": null,\\n          \\\"category_id\\\": null,\\n          \\\"internal_notes\\\": \\\"\\\",\\n          \\\"line_item_name\\\": \\\"sprocket\\\",\\n          \\\"line_item_sku\\\": null,\\n          \\\"address_kind\\\": \\\"F\\\",\\n          \\\"recipient_last_name\\\": \\\"smith\\\",\\n          \\\"recipient_requested_service\\\": null,\\n          \\\"gift\\\": false,\\n          \\\"prime_order_id\\\": 58763481,\\n          \\\"state\\\": \\\"DC\\\",\\n          \\\"owner_id\\\": 50385,\\n          \\\"denormalized_ordered_at\\\": \\\"2016-09-16T20:52:13Z\\\",\\n          \\\"grab_bag\\\": {\\n            \\n          },\\n          \\\"line_item_bin_picking_number\\\": null,\\n          \\\"denormalized_ext_order_id\\\": \\\"ABC12345\\\",\\n          \\\"packing_slip_generated\\\": null,\\n          \\\"denormalized_ext_order_reference_id\\\": \\\"ABC12345\\\",\\n          \\\"denormalized_alternate_order_id\\\": null,\\n          \\\"denormalized_sales_channel\\\": null,\\n          \\\"custom_1\\\": null,\\n          \\\"custom_2\\\": null,\\n          \\\"custom_3\\\": null\\n        }\\n      }\\n    ],\\n    \\\"store_api_key\\\": \\\"d0e8e360d4a1d42a53eed5439150a881\\\",\\n    \\\"shipments\\\": [\\n      \\n    ],\\n    \\\"updated_at\\\": \\\"2016-09-16T20:52:11Z\\\",\\n    \\\"internal_notes\\\": \\\"\\\",\\n    \\\"meta_data\\\": null,\\n    \\\"prime_order_id\\\": 58763481,\\n    \\\"is_prime\\\": null,\\n    \\\"split_from_order_id\\\": null\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Possible Exceptions\"\n}\n[/block]\n## ShippingEasy_AuthenticationError\nYour credentials could not be authenticated.\n\n## ShippingEasy_InvalidRequestError\nThe order could not be created on the server for one or more of the following reasons:\n\n* The JSON payload could not be parsed.\n* One or more of the supplied data attributes failed validation and is missing or incorrect.\n* An order with the supplied external_order_identifier already exists for that store.\n\nThe exception will contain a message that indicates which of these conditions failed.","excerpt":"","slug":"creating-an-order-2","type":"basic","title":"Creating an order"}
To add an order to a store, first instantiate a new Client object with the ShippingEasy account's API key and API secret. Then use CreateOrder to specify the store's API key and the data for the order: [block:code] { "codes": [ { "code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing ShippingEasy;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String baseUrl = \"https://app.shippingeasy.com\";\n\n // from Settings > API Credentials\n String apiKey = \"7e419816e705d1cd6d7d533bf484ad\";\n String apiSecret = \"3ca2e94bca001112f3a89e208dec55e89d630bbd33a0dcf591847cc5944d21\";\n\n // from Settings > Stores\n String storeApiKey = \"d0e8e360d4a1d42a53eed5439150a8\";\n\n var client = new Client(apiKey, apiSecret, baseUrl);\n\n var result = client.CreateOrder(storeApiKey, new Order\n {\n ExternalOrderIdentifier = \"ABC1234\",\n OrderedAt = DateTime.Now,\n Recipients =\n {\n new Recipient\n {\n FirstName = \"Colin\",\n LastName = \"Smith\",\n Address = \"1600 Pennsylvania Ave\",\n City = \"Washington\",\n State = \"DC\",\n LineItems = {\n new LineItem { ItemName = \"Sprocket\", Quantity = 7 }\n }\n }\n },\n });\n HttpResponse response = result.HttpResponse;\n }\n }\n}\n", "language": "csharp" } ] } [/block] If successful the call will return a JSON hash with the ShippingEasy order ID, as well as the external order identifier originally supplied in your call: [block:code] { "codes": [ { "code": "{\n \"order\": {\n \"id\": 58763481,\n \"external_order_identifier\": \"ABC12345\",\n \"ext_order_reference_id\": \"ABC12345\",\n \"owner_id\": 50385,\n \"ordered_at\": \"2016-09-16T20:52:13Z\",\n \"order_status\": \"ready_for_shipment\",\n \"parent_order_id\": null,\n \"source_order_ids\": null,\n \"total_including_tax\": \"0.00\",\n \"total_excluding_tax\": \"0.00\",\n \"discount_amount\": \"0.00\",\n \"coupon_discount\": \"0.00\",\n \"subtotal_including_tax\": \"0.00\",\n \"subtotal_excluding_tax\": \"0.00\",\n \"subtotal_tax\": \"0.00\",\n \"total_tax\": \"0.00\",\n \"base_shipping_cost\": \"0.00\",\n \"shipping_cost_including_tax\": \"0.00\",\n \"shipping_cost_excluding_tax\": \"0.00\",\n \"shipping_cost_tax\": \"0.00\",\n \"base_handling_cost\": \"0.00\",\n \"handling_cost_excluding_tax\": \"0.00\",\n \"handling_cost_including_tax\": \"0.00\",\n \"handling_cost_tax\": \"0.00\",\n \"base_wrapping_cost\": \"0.00\",\n \"wrapping_cost_excluding_tax\": \"0.00\",\n \"wrapping_cost_including_tax\": \"0.00\",\n \"wrapping_cost_tax\": \"0.00\",\n \"billing_company\": null,\n \"billing_first_name\": null,\n \"billing_last_name\": null,\n \"billing_address\": null,\n \"billing_address2\": null,\n \"billing_city\": null,\n \"billing_state\": null,\n \"billing_country\": null,\n \"billing_postal_code\": null,\n \"billing_phone_number\": null,\n \"billing_email\": null,\n \"recipients\": [\n {\n \"company\": null,\n \"first_name\": \"Colin\",\n \"last_name\": \"Smith\",\n \"address\": \"1600 Pennsylvania Ave\",\n \"address2\": null,\n \"address3\": null,\n \"city\": \"Washington\",\n \"residential\": null,\n \"state\": \"DC\",\n \"province\": null,\n \"country\": \"United States\",\n \"postal_code\": null,\n \"postal_code_plus_4\": null,\n \"phone_number\": null,\n \"email\": null,\n \"base_cost\": \"0.00\",\n \"cost_excluding_tax\": \"0.00\",\n \"cost_including_tax\": \"0.00\",\n \"cost_tax\": \"0.00\",\n \"base_handling_cost\": \"0.00\",\n \"handling_cost_excluding_tax\": \"0.00\",\n \"handling_cost_including_tax\": \"0.00\",\n \"handling_cost_tax\": \"0.00\",\n \"shipping_zone_id\": null,\n \"shipping_zone_name\": null,\n \"items_total\": 0,\n \"shipping_method\": null,\n \"items_shipped\": 0,\n \"ext_shipping_detail_id\": null,\n \"line_items\": [\n {\n \"item_name\": \"Sprocket\",\n \"sku\": null,\n \"bin_picking_number\": null,\n \"bundled_product\": null,\n \"weight_in_ounces\": \"0.0\",\n \"quantity\": 7,\n \"total_excluding_tax\": \"0.00\",\n \"price_excluding_tax\": \"0.00\",\n \"unit_price\": \"0.00\",\n \"ext_line_item_id\": null,\n \"ext_product_id\": null,\n \"product_options\": null,\n \"uuid\": \"70e9f2c7-7433-4ea2-8fcc-a3bb855b0298\",\n \"order_source_id\": 46993771,\n \"gift_message\": null\n }\n ],\n \"original_order\": {\n \"id\": 58763481,\n \"customer_id\": 3633,\n \"store_id\": 52377,\n \"order_detail_id\": 58842251,\n \"workflow_state\": \"ready_for_shipment\",\n \"shipment_id\": null,\n \"destination_id\": null,\n \"split_from_order_id\": null,\n \"total_weight_in_ounces\": \"0.0\",\n \"total_quantity\": 7,\n \"is_international\": false,\n \"usps_shipping_zone\": null,\n \"created_at\": \"2016-09-16T20:52:11Z\",\n \"updated_at\": \"2016-09-16T20:52:11Z\",\n \"ext_shipment_confirmation_id\": null,\n \"store_order_status\": \"awaiting_shipment\",\n \"drop_ship_tracking_number\": null,\n \"category_id\": null,\n \"internal_notes\": \"\",\n \"line_item_name\": \"sprocket\",\n \"line_item_sku\": null,\n \"address_kind\": \"F\",\n \"recipient_last_name\": \"smith\",\n \"recipient_requested_service\": null,\n \"gift\": false,\n \"prime_order_id\": 58763481,\n \"state\": \"DC\",\n \"owner_id\": 50385,\n \"denormalized_ordered_at\": \"2016-09-16T20:52:13Z\",\n \"grab_bag\": {\n \n },\n \"line_item_bin_picking_number\": null,\n \"denormalized_ext_order_id\": \"ABC12345\",\n \"packing_slip_generated\": null,\n \"denormalized_ext_order_reference_id\": \"ABC12345\",\n \"denormalized_alternate_order_id\": null,\n \"denormalized_sales_channel\": null,\n \"custom_1\": null,\n \"custom_2\": null,\n \"custom_3\": null\n }\n }\n ],\n \"store_api_key\": \"d0e8e360d4a1d42a53eed5439150a881\",\n \"shipments\": [\n \n ],\n \"updated_at\": \"2016-09-16T20:52:11Z\",\n \"internal_notes\": \"\",\n \"meta_data\": null,\n \"prime_order_id\": 58763481,\n \"is_prime\": null,\n \"split_from_order_id\": null\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Possible Exceptions" } [/block] ## ShippingEasy_AuthenticationError Your credentials could not be authenticated. ## ShippingEasy_InvalidRequestError The order could not be created on the server for one or more of the following reasons: * The JSON payload could not be parsed. * One or more of the supplied data attributes failed validation and is missing or incorrect. * An order with the supplied external_order_identifier already exists for that store. The exception will contain a message that indicates which of these conditions failed.