Overview
This article explains how to bulk create a Bookings via Postman, with a CSV file.
- Prerequisites
- Step-by-step guide
- Prepare Postman
- Run it in Postman
- BONUS: Adding further variables to the Google Sheet bulk importer
- Related resources
Prerequisites
- You have at least a free account on Postman.
- You have created an Admin API Key on your MotionTools account.
Step-by-step guide
Prepare the CSV file
Duplicate this Google Sheet template and fill in all your bookings' data you want to bulk create.
-
service_id
- The Service which includes possible Capability options. If you don’t mention this in the body we’ll take the default service — more info.
-
capabilities
- Each Capability key + selected option for the bookings you create i.e.
“vehicle_type”:”bike_cargo”
— more info.
- Each Capability key + selected option for the bookings you create i.e.
-
customer_id
- The Customer you attach to the booking. This can be a placeholder (same for all bookings) if you mention recipient data on each stop instead — more info.
-
custom_content
- Custom stops data like checklists visible in the MotionTools app — more info.
-
metadata
- Custom stops or bookings data visible on the Dashboard only and via API.
-
scheduled_at
- Start time of the booking.
Make sure to use a scheduled_at
time for bookings in the future or now
for instant bookings, otherwise booking creation will fail! The stops lat & lng should also be inside a Service area.
Prepare Postman
In the next step, open the Postman application and import the CSV file to create bookings in MotionTools.
- Sign in on Postman
- Import this example Environment and replace the following credentials:
- your_platform_variables.postman_environment.json
- Your
API Key
⇒ More info -
base_url
⇒ More info
- Import one of the following Collections (depending on your booking structure):
-
2-stop bookings
-
1-stop bookings
-
Run it in Postman
- Make sure you select the Environment.
- Click on Runner on the bottom right.
- Hit Select File and open your CSV file.
- The number of iterations are reflected as the columns of your CSV file. It will create a booking for each of them.
- Drag the Collection into the Runner, then hit Run iterate CSV file to bulk create bookings.
If it gives you a 200 response, the booking creation was a success and you should find the bookings in your MotionTools dashboard!
If you need to add additional data to the payload you can find the full scope in our API Docs.
BONUS: Adding further variables to the Google Sheet bulk importer
- If you want to add more variables and not have them hardcoded in the POST Request, you can follow these steps:
- Add more columns in the Google Sheet on the right.
- Add the same header name in the Variables list in the Postman Collection.
- Mention the variables in the Request Body i.e.
{{Metadata_external_order_id}}
. - Proceed with the importing using the Runner function as shown above.