Embed Auto-Generated IDs

To reference an auto-generated ID, either a BNG (business number generator) or a database sequence, in other parts of the payload dynamically, you must follow the "{%ID%}" pattern.

The following is an example of creating a shipment while using BNG for Shipment Ship Units and database sequence for SEquipment and referencing both in other parts of the payload.

Note:

You'd be assigning the dynamic ID to XID for creation but reference the generated value to the GID directly. You don't need to specify the domain name while referencing. In the following example, "{%ref_ssu_id1%}" is assigned to the sShipUnitXid. While under sShipUnits as that’s where the sShipUnit is being created. However, in this scenario it's associated with the sShipUnitGid (not the sShipUnitXid) when referenced under stop details.

{
    "shipmentXid": "TEST",
    ...
    "sEquipments": {
        "items": [
            {
                "sEquipment": {
                    "sEquipmentXid": "{%ref_id_sequip%}",
                    ...
				}
			}
		]
	},
    "stops": {
        "items": [
            {
                "stopNum": 1,
                ...
                "details": {
                    "items": [
                        {
                            "sShipUnitGid": "{%ref_ssu_id1%}",
                            ...
						}
					]
				}
			},
            {
                "stopNum": 2,
                ...
                "details": {
                    "items": [
                        {
                            "sShipUnitGid": "{%ref_ssu_id1%}",
                            ...
						}
					]
				}
			}
		]
	},
    "sShipUnits": {
        "items": [
            {
                "sShipUnitXid": "{%ref_ssu_id1%}",
				...
				"sEquipments": {
                    "items": [
                        {
                            "sEquipmentGid": "{%ref_id_sequip%}"
						}
					]
				}
			}
		]
	}
}

Below is a complete example of a shipment payload to create a shipment using auto generated IDs for shipment ship units and shipment equipment, along with referencing them in appropriate places.

{
	"shipmentXid": "TEST_123",
	"shipmentName": "SHIPMENT of TEST_123",
	"transportModeGid": "TL",
	"isTemplate": false,
	"isPrimary": true,
	"isSpotCosted": false,
	"isCreditNote": false,
	"totalActualCost": {
		"value": 400.0,
		"currency": "USD"
	},
	"totalWeightedCost": {
		"value": 4.0,
		"currency": "USD"
	},
	"totalTransCost": {
		"value": 400.0,
		"currency": "USD"
	},
	"loadedDistance": {
		"value": 1354.02,
		"unit": "MI"
	},
	"unloadedDistance": {
		"value": 0.0,
		"unit": "MI"
	},
	"startTime": {
		"value": "2016-02-03T00:09:58-06:00"
	},
	"endTime": {
		"value": "2016-02-06T10:00:00-05:00"
	},
	"parentLegGid": "GUEST.15087",
	"rateOfferingGid": "GUEST.TL",
	"rateGeoGid": "GUEST.25073",
	"isAutoMergeConsolidate": false,
	"perspective": "B",
	"totalWeight": {
		"value": 29400.0,
		"unit": "LB"
	},
	"totalVolume": {
		"value": 1456.0,
		"unit": "CUFT"
	},
	"totalShipUnitCount": 28,
	"totalPackagingUnitCount": 2240,
	"totalItemPackageCount": 2240,
	"shipmentTypeGid": "TRANSPORT",
	"shipmentAsWork": false,
	"checkTimeConstraint": true,
	"checkCostConstraint": true,
	"checkCapacityConstraint": true,
	"weighCode": "A",
	"rule7": false,
	"shipmentReleased": true,
	"plannedCost": {
		"value": 400.0,
		"currency": "USD"
	},
	"tariffName": "GENERAL TARRIF",
	"tariffDate": {
		"value": "2009-05-01"
	},
	"isHazardous": false,
	"isTemperatureControl": false,
	"isCostFixed": false,
	"isServiceTimeFixed": false,
	"isRateGeoFixed": false,
	"isRateOfferingFixed": false,
	"isServprovFixed": false,
	"isPreload": false,
	"isFixedTenderContact": false,
	"isToBeHeld": false,
	"isPreferredCarrier": false,
	"isEquipmentFixed": false,
	"isRecalcTotals": true,
	"hasAppointments": false,
	"feasibilityCodeGid": "FEASIBLE",
	"numOrderReleases": 1,
	"numStops": 2,
	"totalNetWeight": {
		"value": 28000.0,
		"unit": "LB"
	},
	"totalNetVolume": {
		"value": 1400.0,
		"unit": "CUFT"
	},
	"earliestStartTime": {
		"value": "2013-03-31T00:54:49-05:00"
	},
	"latestStartTime": {
		"value": "2013-04-26T17:59:00-05:00"
	},
	"inTrailerBuild": false,
	"firstEquipmentGroupGid": "28FT DRY VAN",
	"weightUtilization": 0.98,
	"volumeUtilization": 0.70338,
	"equipRefUnitUtilization": 0.0,
	"isCpctyOverrideApplicable": false,
	"plannedRateOfferingGid": "GUEST.TL",
	"plannedTransportModeGid": "TL",
	"plannedRateGeoGid": "GUEST.25073",
	"isPermanent": false,
	"isMemoBl": true,
	"dutyPaid": "NA",
	"currencyGid": "USD",
	"exchangeRateGid": "DEFAULT",
	"totalDeclaredValue": {
		"value": 0.0,
		"currency": "USD"
	},
	"isProfitSplit": false,
	"isAdvancedCharge": false,
	"isFixedDistance": false,
	"chargeableWeight": {
		"value": 29400.0,
		"unit": "LB"
	},
	"prevDropInventoryProcessed": false,
	"pickInventoryProcessed": false,
	"dropInventoryProcessed": false,
	"chargeableVolume": {
		"value": 1456.0,
		"unit": "CUFT"
	},
	"domainName": "GUEST",
	"planningParameterSetGid": "GUEST.TEST",
	"attribute1": "GUEST.DEST_LAX",
	"attribute2": "GUEST.12984",
	"attribute4": "JQE",
	"attribute11": "58",
	"isFixedVoyage": false,
	"isArRouteCodeFixed": false,
	"sEquipments": {
		"items": [
			{
				"sEquipmentGid": "GUEST.6011",
				"pickupStopNum": 1,
				"dropoffStopNum": 2
			},
			{
				"sEquipment": {
					"sEquipmentXid": "{%ref_id_sequip2%}",
					"equipmentGroupGid": "28FT DRY VAN",
					"loadConfigVolume": {
						"value": 1456.0,
						"unit": "CUFT"
					},
					"isFreight": true,
					"domainName": "GUEST"
				},
				"pickupStopNum": 1,
				"dropoffStopNum": 2,
				"domainName": "GUEST"
			},
			{
				"sEquipment": {
					"sEquipmentXid": "{%ref_id_sequip3%}",
					"equipmentGroupGid": "28FT DRY VAN",
					"loadConfigVolume": {
						"value": 1456.0,
						"unit": "CUFT"
					},
					"isFreight": true,
					"domainName": "GUEST"
				},
				"pickupStopNum": 1,
				"dropoffStopNum": 2,
				"domainName": "GUEST"
			}
		]
	},
	"stops": {
		"items": [
			{
				"stopNum": 1,
				"location": {
					"locationGid": "GUEST.FORT JAMES - MUSKOGEE",
					"locationXid": "FORT JAMES - MUSKOGEE",
					"locationName": "FORT JAMES - MUSKOGEE",
					"city": "MUSKOGEE",
					"provinceCode": "OK",
					"postalCode": "74403-8900",
					"countryCode3Gid": "USA",
					"zone1": "624330",
					"timeZoneGid": "America/Chicago",
					"lat": 35.73955,
					"lon": -95.34921,
					"isTemporary": false,
					"isMakeApptBeforePlan": false,
					"isShipperKnown": true,
					"isAddressValid": "N",
					"slotTimeInterval": {
						"value": 1.0,
						"unit": "H"
					},
					"isLtlSplitable": true,
					"useAppointmentPriority": false,
					"scheduleLowPriorityAppoint": false,
					"enforceTimeWindowAppoint": true,
					"scheduleInfeasibleAppoint": true,
					"bbIsNewStore": false,
					"excludeFromRouteExecution": false,
					"appointDisplayStartTime": 0,
					"isTemplate": false,
					"allowDriverRest": false,
					"apptObjectType": "S",
					"isFixedAddress": false,
					"primaryAddressLineSeq": 1,
					"domainName": "GUEST",
					"isActive": true,
					"addressUpdateDate": {
						"value": "2018-05-02T09:14:33Z"
					},
					"isWmsFacility": false,
					"apptEnforceActTimeSg": false,
					"hasMultipleMatches": "N"
				},
				"locationRoleGid": "SHIPFROM/SHIPTO",
				"plannedArrival": {
					"value": "2016-02-03T00:09:58-06:00"
				},
				"estimatedArrival": {
					"value": "2016-02-03T00:09:58-06:00"
				},
				"isFixedArrival": false,
				"plannedDeparture": {
					"value": "2016-02-03T20:00:00-06:00"
				},
				"estimatedDeparture": {
					"value": "2016-02-03T20:00:00-06:00"
				},
				"isFixedDeparture": false,
				"waitTime": {
					"value": 16.83388888888889,
					"unit": "H"
				},
				"restTime": {
					"value": 0.0,
					"unit": "H"
				},
				"driveTime": {
					"value": 0.0,
					"unit": "H"
				},
				"distFromPrevStop": {
					"value": 0.0,
					"unit": "MI"
				},
				"activityTime": {
					"value": 3.0,
					"unit": "H"
				},
				"isPermanent": true,
				"isDepot": false,
				"accessorialTime": {
					"value": 0.0,
					"unit": "H"
				},
				"isFixedDistance": false,
				"rushHourTime": {
					"value": 0.0,
					"unit": "H"
				},
				"isMotherVessel": false,
				"stopType": "P",
				"driverNonPayable": false,
				"domainName": "GUEST",
				"details": {
					"items": [
						{
							"sShipUnitGid": "{%ref_id1%}",
							"activity": "P",
							"activityTime": {
								"value": 0.0,
								"unit": "H"
							},
							"isPermanent": false,
							"domainName": "GUEST"
						},
						{
							"sShipUnitGid": "{%ref_id3%}",
							"activity": "P",
							"activityTime": {
								"value": 0.0,
								"unit": "H"
							},
							"isPermanent": false,
							"domainName": "GUEST"
						}
					]
				}
			},
			{
				"stopNum": 2,
				"location": {
					"locationGid": "GUEST.BAKER STORE 2",
					"locationXid": "BAKER STORE 2",
					"locationName": "BAKER'S LUMBER STORE 2",
					"city": "NORRISTOWN",
					"province": "PENNSYLVANIA",
					"provinceCode": "PA",
					"postalCode": "19401-5667",
					"countryCode3Gid": "USA",
					"timeZoneGid": "America/New_York",
					"lat": 40.12852,
					"lon": -75.33792,
					"isTemporary": false,
					"isMakeApptBeforePlan": false,
					"isShipperKnown": true,
					"isAddressValid": "N",
					"rateClassificationGid": "COMMERCIAL",
					"equipmentGroupProfileGid": "GUEST.EQ GROUP FOR BAKER",
					"isLtlSplitable": true,
					"bbIsNewStore": false,
					"excludeFromRouteExecution": false,
					"isTemplate": false,
					"apptObjectType": "S",
					"isFixedAddress": false,
					"primaryAddressLineSeq": 1,
					"domainName": "GUEST",
					"isActive": true,
					"addressUpdateDate": {
						"value": "2018-05-02T09:15:46Z"
					},
					"isWmsFacility": false,
					"apptEnforceActTimeSg": false,
					"hasMultipleMatches": "N",
					"updateDate": {
						"value": "2018-05-02T09:15:47Z"
					},
					"insertDate": {
						"value": "2001-10-15T11:07:49Z"
					}
				},
				"locationRoleGid": "SHIPFROM/SHIPTO",
				"plannedArrival": {
					"value": "2016-02-05T13:37:06-05:00"
				},
				"estimatedArrival": {
					"value": "2016-02-05T13:37:06-05:00"
				},
				"isFixedArrival": false,
				"plannedDeparture": {
					"value": "2016-02-06T10:00:00-05:00"
				},
				"estimatedDeparture": {
					"value": "2016-02-06T10:00:00-05:00"
				},
				"isFixedDeparture": false,
				"waitTime": {
					"value": 18.381666666666668,
					"unit": "H"
				},
				"restTime": {
					"value": 16.0,
					"unit": "H"
				},
				"driveTime": {
					"value": 24.618333333333332,
					"unit": "H"
				},
				"distFromPrevStop": {
					"value": 1354.02,
					"unit": "MI"
				},
				"activityTime": {
					"value": 2.0,
					"unit": "H"
				},
				"isPermanent": true,
				"isDepot": false,
				"accessorialTime": {
					"value": 0.0,
					"unit": "H"
				},
				"isFixedDistance": false,
				"rushHourTime": {
					"value": 0.0,
					"unit": "H"
				},
				"isMotherVessel": false,
				"stopType": "D",
				"driverNonPayable": false,
				"distanceType": "L",
				"domainName": "GUEST",
				"details": {
					"items": [
						{
							"sShipUnitGid": "{%ref_id1%}",
							"activity": "P",
							"activityTime": {
								"value": 0.0,
								"unit": "H"
							},
							"isPermanent": false,
							"domainName": "GUEST"
						},
						{
							"sShipUnitGid": "{%ref_id2%}",
							"activity": "P",
							"activityTime": {
								"value": 0.0,
								"unit": "H"
							},
							"isPermanent": false,
							"domainName": "GUEST"
						}
					]
				}
			}
		]
	},
	"sShipUnits": {
		"items": [
			{
				"sShipUnitXid": "{%ref_id1%}",
				"transportHandlingUnitGid": "GUEST.48 X 40 PALLET",
				"unitLength": {
					"value": 4.0,
					"unit": "FT"
				},
				"unitWidth": {
					"value": 3.333333333333333,
					"unit": "FT"
				},
				"unitHeight": {
					"value": 8.483333333333333,
					"unit": "FT"
				},
				"unitWeight": {
					"value": 1050.0,
					"unit": "LB"
				},
				"unitVolume": {
					"value": 52.0,
					"unit": "CUFT"
				},
				"isSplitable": false,
				"shipUnitCount": 20,
				"unitNetWeight": {
					"value": 1000.0,
					"unit": "LB"
				},
				"unitNetVolume": {
					"value": 50.0,
					"unit": "CUFT"
				},
				"receivedNetWeight": {
					"value": 0.0,
					"unit": "LB"
				},
				"receivedNetVolume": {
					"value": 0.0,
					"unit": "CUFT"
				},
				"isCountSplittable": true,
				"totalGrossWeight": {
					"value": 21000.0,
					"unit": "LB"
				},
				"totalGrossVolume": {
					"value": 1040.0,
					"unit": "CUFT"
				},
				"rangeStart": 1,
				"rangeEnd": 20,
				"domainName": "GUEST",
				"isAllowRepack": false,
				"sEquipments": {
					"items": [
						{
							"sEquipmentGid": "GUEST.6011"
						}
					]
				},
				"remarks": {
					"items": [
						{
							"remarkSequence": 1,
							"remarkQualGid": "ACCEPT_RAINBOW_PALLET",
							"remarkText": "SAMPLE_RAINBOW_PALLET",
							"domainName": "GUEST"
						},
						{
							"remarkSequence": 2,
							"remarkQualGid": "CARRIER_ID",
							"remarkText": "SAMPLE_CARRIER_ID",
							"domainName": "GUEST"
						}
					]
				},
				"accessorials": {
					"items": [
						{
							"accessorialCodeGid": "GUEST.INSURANCE",
							"domainName": "GUEST"
						}
					]
				},
				"lines": {
					"items": [
						{
							"sShipUnitLineNo": 1,
							"weight": {
								"value": 0.0,
								"unit": "LB"
							},
							"volume": {
								"value": 0.0,
								"unit": "CUFT"
							},
							"itemPackageCount": 10,
							"packagedItem": {
								"packagedItemXid": "DEFAULT",
								"description": "DEFAULT DESCRIPTION",
								"itemGid": "DEFAULT",
								"packageShipUnitWeight": {
									"value": 0.0,
									"unit": "LB"
								},
								"packageSuVolume": {
									"value": 0.0,
									"unit": "CUFT"
								},
								"isDefaultPackaging": false,
								"isHazardous": false,
								"domainName": "PUBLIC",
								"isAllowMixedFreight": true,
								"isNestable": false
							},
							"domainName": "GUEST",
							"marinePollutantIndicator": false,
							"hotIndicator": false,
							"remarks": {
								"items": [
									{
										"remarkSequence": 1,
										"remarkQualGid": "CARRIER_ID",
										"remarkText": "SAMPLE_SSU_LINE_CARRIER",
										"domainName": "GUEST"
									}
								]
							}
						}
					]
				}
			},
			{
				"sShipUnitXid": "{%ref_id2%}",
				"transportHandlingUnitGid": "GUEST.48 X 40 PALLET",
				"unitLength": {
					"value": 4.0,
					"unit": "FT"
				},
				"unitWidth": {
					"value": 3.333333333333333,
					"unit": "FT"
				},
				"unitHeight": {
					"value": 8.483333333333333,
					"unit": "FT"
				},
				"unitWeight": {
					"value": 1050.0,
					"unit": "LB"
				},
				"unitVolume": {
					"value": 52.0,
					"unit": "CUFT"
				},
				"isSplitable": false,
				"shipUnitCount": 20,
				"unitNetWeight": {
					"value": 1000.0,
					"unit": "LB"
				},
				"unitNetVolume": {
					"value": 50.0,
					"unit": "CUFT"
				},
				"receivedNetWeight": {
					"value": 0.0,
					"unit": "LB"
				},
				"receivedNetVolume": {
					"value": 0.0,
					"unit": "CUFT"
				},
				"isCountSplittable": true,
				"totalGrossWeight": {
					"value": 21000.0,
					"unit": "LB"
				},
				"totalGrossVolume": {
					"value": 1040.0,
					"unit": "CUFT"
				},
				"rangeStart": 1,
				"rangeEnd": 20,
				"domainName": "GUEST",
				"isAllowRepack": false,
				"sEquipments": {
					"items": [
						{
							"sEquipmentGid": "{%ref_id_sequip2%}"
						},
						{
							"sEquipmentGid": "GUEST.6011"
						}
					]
				},
				"remarks": {
					"items": [
						{
							"remarkSequence": 1,
							"remarkQualGid": "ACCEPT_RAINBOW_PALLET",
							"remarkText": "SAMPLE_RAINBOW_PALLET",
							"domainName": "GUEST"
						},
						{
							"remarkSequence": 2,
							"remarkQualGid": "CARRIER_ID",
							"remarkText": "SAMPLE_CARRIER_ID",
							"domainName": "GUEST"
						}
					]
				},
				"accessorials": {
					"items": [
						{
							"accessorialCodeGid": "GUEST.INSURANCE",
							"domainName": "GUEST"
						}
					]
				},
				"lines": {
					"items": [
						{
							"sShipUnitLineNo": 2,
							"weight": {
								"value": 0.0,
								"unit": "LB"
							},
							"volume": {
								"value": 0.0,
								"unit": "CUFT"
							},
							"itemPackageCount": 9,
							"packagedItem": {
								"packagedItemXid": "DEFAULT",
								"description": "DEFAULT DESCRIPTION",
								"itemGid": "DEFAULT",
								"packageShipUnitWeight": {
									"value": 0.0,
									"unit": "LB"
								},
								"packageSuVolume": {
									"value": 0.0,
									"unit": "CUFT"
								},
								"isDefaultPackaging": false,
								"isHazardous": false,
								"domainName": "PUBLIC",
								"isAllowMixedFreight": true,
								"isNestable": false
							},
							"domainName": "GUEST",
							"marinePollutantIndicator": false,
							"hotIndicator": false,
							"remarks": {
								"items": [
									{
										"remarkSequence": 1,
										"remarkQualGid": "CARRIER_ID",
										"remarkText": "SAMPLE_SSU_LINE_CARRIER",
										"domainName": "GUEST"
									}
								]
							}
						}
					]
				}
			},
			{
				"sShipUnitXid": "{%ref_id3%}",
				"transportHandlingUnitGid": "GUEST.48 X 40 PALLET",
				"unitLength": {
					"value": 4.0,
					"unit": "FT"
				},
				"unitWidth": {
					"value": 3.333333333333333,
					"unit": "FT"
				},
				"unitHeight": {
					"value": 8.483333333333333,
					"unit": "FT"
				},
				"unitWeight": {
					"value": 1050.0,
					"unit": "LB"
				},
				"unitVolume": {
					"value": 52.0,
					"unit": "CUFT"
				},
				"isSplitable": false,
				"shipUnitCount": 20,
				"unitNetWeight": {
					"value": 1000.0,
					"unit": "LB"
				},
				"unitNetVolume": {
					"value": 50.0,
					"unit": "CUFT"
				},
				"receivedNetWeight": {
					"value": 0.0,
					"unit": "LB"
				},
				"receivedNetVolume": {
					"value": 0.0,
					"unit": "CUFT"
				},
				"isCountSplittable": true,
				"totalGrossWeight": {
					"value": 21000.0,
					"unit": "LB"
				},
				"totalGrossVolume": {
					"value": 1040.0,
					"unit": "CUFT"
				},
				"rangeStart": 1,
				"rangeEnd": 20,
				"domainName": "GUEST",
				"isAllowRepack": false,
				"sEquipments": {
					"items": [
						{
							"sEquipmentGid": "{%ref_id_sequip2%}"
						},
						{
							"sEquipmentGid": "{%ref_id_sequip3%}"
						}
					]
				},
				"remarks": {
					"items": [
						{
							"remarkSequence": 1,
							"remarkQualGid": "ACCEPT_RAINBOW_PALLET",
							"remarkText": "SAMPLE_RAINBOW_PALLET",
							"domainName": "GUEST"
						},
						{
							"remarkSequence": 2,
							"remarkQualGid": "CARRIER_ID",
							"remarkText": "SAMPLE_CARRIER_ID",
							"domainName": "GUEST"
						}
					]
				},
				"accessorials": {
					"items": [
						{
							"accessorialCodeGid": "GUEST.INSURANCE",
							"domainName": "GUEST"
						}
					]
				},
				"lines": {
					"items": [
						{
							"sShipUnitLineNo": 3,
							"weight": {
								"value": 0.0,
								"unit": "LB"
							},
							"volume": {
								"value": 0.0,
								"unit": "CUFT"
							},
							"itemPackageCount": 10,
							"packagedItem": {
								"packagedItemXid": "DEFAULT",
								"description": "DEFAULT DESCRIPTION",
								"itemGid": "DEFAULT",
								"packageShipUnitWeight": {
									"value": 0.0,
									"unit": "LB"
								},
								"packageSuVolume": {
									"value": 0.0,
									"unit": "CUFT"
								},
								"isDefaultPackaging": false,
								"isHazardous": false,
								"domainName": "PUBLIC",
								"isAllowMixedFreight": true,
								"isNestable": false
							},
							"domainName": "GUEST",
							"marinePollutantIndicator": false,
							"hotIndicator": false,
							"remarks": {
								"items": [
									{
										"remarkSequence": 1,
										"remarkQualGid": "CARRIER_ID",
										"remarkText": "SAMPLE_SSU_LINE_CARRIER",
										"domainName": "GUEST"
									}
								]
							}
						}
					]
				}
			}
		]
	}
}