Skip to content

Instantly share code, notes, and snippets.

@Mozu-CS
Created February 11, 2016 01:06
Show Gist options
  • Select an option

  • Save Mozu-CS/10e9021aa9780320692f to your computer and use it in GitHub Desktop.

Select an option

Save Mozu-CS/10e9021aa9780320692f to your computer and use it in GitHub Desktop.
A gist for adding locations through the API
var FiddlerProxy = require('mozu-node-sdk/plugins/fiddler-proxy');
var apiContext = require('mozu-node-sdk/clients/platform/application')();
apiContext.plugins = [FiddlerProxy];
var locationResource = require('mozu-node-sdk/clients/commerce/admin/location')(apiContext);
var location =
{
"code": "retailops1",
"locationTypes": [{ "code": "warehouse", "name": "Warehouse" }],
"fulfillmentTypes": [{ "code": "DS", "name": "Direct Ship", "shippingRequired": true }],
"shippingOriginContact":
{
"firstName": "",
"middleNameOrInitial": "",
"lastNameOrSurname": "",
"companyOrOrganization": "My Company",
"phoneNumber": "(555) 555-5555",
"email": "[email protected]"
},
"isDisabled": false,
"name": "Retailops Default Location",
"description": "",
"address":
{
"address1": "123 Example Ave",
"address2": "",
"address3": "",
"address4": "",
"cityOrTown": "San Diego",
"stateOrProvince": "CA",
"countryCode": "US",
"postalOrZipCode": "80301",
"addressType": "Commercial",
"addressIsValidated": false
},
"geo": { "lat": null, "lng": null },
"phone": "",
"fax": "",
"note": "",
"supportsInventory": false,
"allowFulfillmentWithNoStock": false,
"tags": [],
"regularHours": { "sunday": { "label": "" }, "monday": { "label": "" }, "tuesday": { "label": "" }, "wednesday": { "label": "" }, "thursday": { "label": "" }, "friday": { "label": "" }, "saturday": { "label": "" } }
}
locationResource.addLocation(location)
.then(log)
.catch(reportError);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment