Ship Connect API Integration
The following scripts can be called in the ShipManager file to create records without creating a relationship by simply passing XML per the sample below.
A good example of needing to do this would be if you wanted to create shipments from the company record in a CRM system. The shipment is not related to an order or invoice id, and you may likely want to create shipments from that record on an ongoing basis.
API - New Shipment from XML
This API will create a new ship (and package/item) record and return back the resultant ID which can then be passed to the external show/ship script.
The API script will return back XML with an error code (the FileMaker error code, if any) and the ID which can be parsed out and placed into a variable or field for subsequent use. See http://www.briandunning.com/cf/1/ for a FileMaker Custom Function that you can use to parse the result. [ex: ExtractData ( $result ; "ID" ; 1 )]
Example Use:
Call "API - New Shipment from XML" with XML data as script parameter
Parse ID from script result and place into a variable
Call "External - Ship" with ID as script parameter to perform ship process
Call "External - Get Status" to get record status
Check status XML element and extract tracking number and cost elements
Sample request: (Note that not all elements below are required to create a shipment. In this sample a single shipment is create with one package and two items)
<Shipment>
<Carrier>UPS</Carrier>
<Service>UPS Ground</Service>
<PaymentMethod>Sender</PaymentMethod>
<ThirdPartyAccount>XYXY11</ThirdPartyAccount>
<ThirdPartyAccountZip>68504</ThirdPartyAccountZip>
<ThirdPartyAccountCountryCode>68504</ThirdPartyAccountCountryCode>
<ShipTo_Name>Smith Co.</ShipTo_Name>
<ShipTo_AttentionName>John Adams</ShipTo_AttentionName>
<ShipTo_AddressLine1>7021 S 34th St. #32</ShipTo_AddressLine1>
<ShipTo_AddressLine2></ShipTo_AddressLine2>
<ShipTo_AddressLine3></ShipTo_AddressLine3>
<ShipTo_City>Lincoln</ShipTo_City>
<ShipTo_StateProvinceCode>NE</ShipTo_StateProvinceCode>
<ShipTo_PostalCode>68516</ShipTo_PostalCode>
<ShipTo_Country>United States</ShipTo_Country>
<ShipTo_PhoneNumber>4037331440</ShipTo_PhoneNumber>
<ShipTo_ResidentialAddress>1</ShipTo_ResidentialAddress>
<ShipTo_EmailAddress>adam@domain.com</ShipTo_EmailAddress>
<ShipFrom_Name>Zoxo Services Inc</ShipFrom_Name>
<ShipFrom_AttentionName>John Adams</ShipFrom_AttentionName>
<ShipFrom_AddressLine1>1234 Main Hwy Ste A</ShipFrom_AddressLine1>
<ShipFrom_AddressLine2></ShipFrom_AddressLine2>
<ShipFrom_AddressLine3></ShipFrom_AddressLine3>
<ShipFrom_City>Lincoln</ShipFrom_City>
<ShipFrom_StateProvinceCode>NE</ShipFrom_StateProvinceCode>
<ShipFrom_PostalCode>68507</ShipFrom_PostalCode>
<ShipFrom_Country>United States</ShipFrom_Country >
<ShipFrom_PhoneNumber>4044328440</ShipFrom_PhoneNumber>
<Email_SendNotification_Receiver>1</Email_SendNotification_Receiver>
<Email_SendNotification_ReceiverTypes>Ship</Email_SendNotification_ReceiverTypes>
<Email_SendNotification_Sender>1</Email_SendNotification_Sender>
<Email_SendNotification_SenderTypes>Exception</Email_SendNotification_SenderTypes>
<Email_SendNotification_Message>Thank you for your order</Email_SendNotification_Message>
<Ref_InvoiceNumber>1004324</Ref_InvoiceNumber>
<Ref_CustomerReference></Ref_CustomerReference>
<Ref_PONumber></Ref_PONumber>
<!-- specific to fedex freight -->
<Freight_FXF_Service>FedEx Freight? Economy|FedEx Freight? Priority</Freight_FXF_Service>
<UserField01>1714140</UserField01>
<UserField02></UserField02>
<UserField03></UserField03>
<UserField04></UserField04>
<UserField05></UserField05>
<UserField06></UserField06>
<UserField07></UserField07>
<UserField08></UserField08>
<UserField09></UserField09>
<UserField10></UserField10>
<UserField_ID>1714140</UserField_ID>
<UserField_Source></UserField_Source>
<UserField_OrderDate></UserField_OrderDate>
<UserField_URL></UserField_URL>
<CODAmount></CODAmount>
<CODAmount_CashiersCheckMoneyOrderOnly></CODAmount_CashiersCheckMoneyOrderOnly>
<Discount></Discount>
<Tax></Tax>
<TaxRate></TaxRate>
<Shipping></Shipping>
<ReturnLabel></ReturnLabel>
<Packages>
<!-- include one or more package elements for multiple boxes-->
<Package>
<Weight>5.5</Weight>
<Packaging>Package</Packaging>
<Value>59.90</Value>
<Length></Length>
<Width></Width>
<Height></Height>
<ProductDesc></ProductDesc>
<UserField01></UserField01>
<UserField02></UserField02>
<Freight_Pieces></Freight_Pieces>
<Freight_Cartons></Freight_Cartons>
<Freight_Class></Freight_Class>
<Freight_NMFC></Freight_NMFC>
<Freight_HazMat>Yes|No</Freight_HazMat>
<Freight_Stackable>Yes|No</Freight_Stackable>
</Package>
</Packages>
<!-- include one or more item elements for multiple items. Items are used for packing slips/invoices and intl shipments-->
<Item>
<SKU>VAAF</SKU>
<Description>Advanced Antioxident</Description>
<CountryOfManufacture></CountryOfManufacture>
<Quantity>1</Quantity>
<QuantityUnits></QuantityUnits>
<UnitPrice>29.95</UnitPrice>
<CustomsValue>29.95</CustomsValue>
<Weight>2.75</Weight>
<HarmonizedCode></HarmonizedCode>
<PartNumber></PartNumber>
<CIMarksAndNumbers></CIMarksAndNumbers>
<UserField01></UserField01>
<UserField02></UserField02>
<UserField03></UserField03>
</Item>
</Shipment>
Sample response:
<Error>0</Error><ID>#</ID>
Note that you can call "External - Get Status" with a ID script parameter to get full ship, package, rating and tracking data for any record in Ship Connect.
API - New rating engine from XML
This API will create a new rating record and return back the resultant ID which can then be passed to the external run script.
Example Use:
Call "API - New rating engine from XML" with XML data as script parameter
Parse ID from script result and place into a variable
Call "External - Run Rating Engine for ID" with ID as script parameter to perform rating process
Call "External - Get Rating Engine Results for ID" to get record status
Parse response for service cost elements
Sample request: (Note that not all elements below are required to create a rate request.)
<Rating>
<ShipTo_Name>xyz</ShipTo_Name>
<ShipTo_Attention>xyz</ShipTo_Attention>
<ShipTo_AddressLine1>xyz</ShipTo_AddressLine1>
<ShipTo_AddressLine2>xyz</ShipTo_AddressLine2>
<ShipTo_City>xyz</ShipTo_City>
<ShipTo_StateProvinceCode>xyz</ShipTo_StateProvinceCode>
<ShipTo_PostalCode>xyz</ShipTo_PostalCode>
<ShipTo_Country>xyz</ShipTo_Country>
<ShipTo_ResidentialAddress>1</ShipTo_ResidentialAddress>
<Ref_InvoiceNumber>xyz</Ref_InvoiceNumber>
<Ref_CustomerReference>xyz</Ref_CustomerReference>
<Ref_PONumber>xyz</Ref_PONumber>
<UserField_ID>xyz</UserField_ID>
<UserField_Source>xyz</UserField_Source>
<UserField01>xyz</UserField01>
<UserField02>xyz</UserField02>
<Weight>10</Weight>
<Value></Value>
<Dim_L></Dim_L>
<Dim_W></Dim_W>
<Dim_H></Dim_H>
</Rating>