Warehouse POST

URI

https://{DATACENTER}.brightpearl.com/public-api/{ACCOUNT}
/warehouse-service/warehouse

Refer to our documentation on URI syntax for more information on how to construct URIs.

Description

Create a new warehouse and return the ID assigned to that warehouse. A default and quarantine location will also be created for that warehouse. You will need to use the location GET message to return the details of those locations.

You may specify the grouping details of a default location when creating a warehouse but if you don't a default location of 0.0.0.0 will be created for that warehouse.

Default warehouse type of 'warehouse' will be applied unless specified otherwise. All acceptable warehouse types are as follows: concession, consignment, miscellaneous, online, store, supplier, 3pl, virtual and warehouse.

If you use warehouse type '3pl' (third part logistics) you also need to supply a logisticsName value. You must not supply this value for any other warehouse type.

Example 1

Create a warehouse with the name 'Bristol'

Request URI

/warehouse

Request body

{
	"name": "Bristol",
	"address": {
		"addressId": 246
	}
}

Response

{
	"response": 23
}

Example 2

Create a warehouse with the name 'Bristol'

Request URI

/warehouse

Request body

{
	"name": "Bristol",
	"address": {
		"addressId": 246
	}
}

Response

{
	"response": 23
}

Example 3

Create a warehouse with the name 'Dublin' and a default location of a.b.c.d

Request URI

/warehouse

Request body

{
	"name": "Dublin",
	"address": {
		"addressId": 246
	},
	"defaultLocation": {
		"groupingA": "a",
		"groupingB": "b",
		"groupingC": "c",
		"groupingD": "d"
	}
}

Response

{
	"response": 24
}

Example 4

Create a warehouse with the name 'Brighton' and the warehouse type 'supplier'

Request URI

/warehouse

Request body

{
	"name": "Brighton",
	"address": {
		"addressId": 247
	},
	"type": "supplier"
}

Response

{
	"response": 25
}

Example 5

Create a third part logistics warehouse

Request URI

/warehouse

Request body

{
	"name": "3PL",
	"type": "3pl",
	"logisticsName": "A name""address": {
		"addressId": 246
	}
}

Response

{
	"response": 26
}

Example 6

Create a warehouse with click and collect enabled.

Request URI

/warehouse

Request body

{
	"name": "New Glasgow Central",
	"address": {
		"typeCode": "warehouse",
		"addressId": 1
	},
	"clickAndCollectEnabled": true,
	"weeklyOperatingPeriods": {
		"timeZone": "Europe/London",
		"periods": [
			{
				"dayOfWeek": 1,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			},
			{
				"dayOfWeek": 2,
				"openingHours": "09:00:00",
				"closingHours": "17:59:00"
			},
			{
				"dayOfWeek": 3,
				"openingHours": "00:00:00",
				"closingHours": "00:00:00"
			},
			{
				"dayOfWeek": 4,
				"openingHours": "00:00:00",
				"closingHours": "00:00:00"
			},
			{
				"dayOfWeek": 5,
				"openingHours": "10:00:00",
				"closingHours": "18:00:00"
			},
			{
				"dayOfWeek": 6,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			},
			{
				"dayOfWeek": 7,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			}
		]
	},
	"collectionSla": {
		"value": 2,
		"timeUnits": "HOURS"
	},
	"externalTransferSlas": [
		{
			"warehouseId": 4,
			"value": 2,
			"timeUnits": "DAYS"
		},
		{
			"warehouseId": 5,
			"value": 4,
			"timeUnits": "WORKING_DAYS"
		},
		{
			"warehouseId": 0,
			"value": 6,
			"timeUnits": "WORKING_DAYS"
		}
	]
}

Response

{
	"response": 27
}

Example 7

Validation error creating a warehouse with click and collect enabled with invalid external transfer warehouse id 30 and value.

Request URI

/warehouse

Request body

{
	"name": "Glasgow Central",
	"address": {
		"typeCode": "warehouse",
		"addressId": 1
	},
	"clickAndCollectEnabled": true,
	"weeklyOperatingPeriods": {
		"timeZone": "Europe/London",
		"periods": [
			{
				"dayOfWeek": 1,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			},
			{
				"dayOfWeek": 2,
				"openingHours": "09:00:00",
				"closingHours": "17:59:00"
			},
			{
				"dayOfWeek": 3,
				"openingHours": "00:00:00",
				"closingHours": "00:00:00"
			},
			{
				"dayOfWeek": 4,
				"openingHours": "00:00:00",
				"closingHours": "00:00:00"
			},
			{
				"dayOfWeek": 5,
				"openingHours": "10:00:00",
				"closingHours": "18:00:00"
			},
			{
				"dayOfWeek": 6,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			},
			{
				"dayOfWeek": 7,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			}
		]
	},
	"collectionSla": {
		"value": 2,
		"timeUnits": "HOURS"
	},
	"externalTransferSlas": [
		{
			"warehouseId": 4,
			"value": 2,
			"timeUnits": "DAYS"
		},
		{
			"warehouseId": 30,
			"value": -4,
			"timeUnits": "DAYS"
		},
		{
			"warehouseId": 0,
			"value": 6,
			"timeUnits": "WORKING_DAYS"
		}
	]
}

Response

{
	"errors": [
		{
			"code": "WHSC-001",
			"message": "No warehouse exists with id 30. Please provide valid warehouse id."
		},
		{
			"code": "WHSC-225",
			"message": "Something went wrong, please double check external transfer sla value is missing or invalid."
		}
	]
}

Example 8

Validation error creating a warehouse with click and collect enabled and multiple external transfer SLAs having same warehouse id.

Request URI

/warehouse

Request body

{
	"name": "Glasgow Central",
	"address": {
		"typeCode": "warehouse",
		"addressId": 1
	},
	"clickAndCollectEnabled": true,
	"weeklyOperatingPeriods": {
		"timeZone": "Europe/London",
		"periods": [
			{
				"dayOfWeek": 1,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			},
			{
				"dayOfWeek": 2,
				"openingHours": "09:00:00",
				"closingHours": "17:59:00"
			},
			{
				"dayOfWeek": 3,
				"openingHours": "00:00:00",
				"closingHours": "00:00:00"
			},
			{
				"dayOfWeek": 4,
				"openingHours": "00:00:00",
				"closingHours": "00:00:00"
			},
			{
				"dayOfWeek": 5,
				"openingHours": "10:00:00",
				"closingHours": "18:00:00"
			},
			{
				"dayOfWeek": 6,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			},
			{
				"dayOfWeek": 7,
				"openingHours": "09:00:00",
				"closingHours": "17:00:00"
			}
		]
	},
	"collectionSla": {
		"value": 2,
		"timeUnits": "HOURS"
	},
	"externalTransferSlas": [
		{
			"warehouseId": 4,
			"value": 2,
			"timeUnits": "DAYS"
		},
		{
			"warehouseId": 4,
			"value": 4,
			"timeUnits": "DAYS"
		},
		{
			"warehouseId": 0,
			"value": 6,
			"timeUnits": "WORKING_DAYS"
		}
	]
}

Response

{
	"errors": [
		{
			"code": "WHSC-224",
			"message": "You must provide unique warehouse id for external transfer warehouse sla."
		}
	]
}