Bulk create Bookings via Postman with a CSV file

Overview

This article explains how to bulk create a Bookings via Postman, with a CSV file.

 

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.
  • 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.

Bulkcreatebookings_Launch_runner.png

 

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.

Bulkcreatebookings_Runner_Postman.gif

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.
       
      Bulkcreatebookings_Further_variables.png
       
  • Mention the variables in the Request Body i.e. {{Metadata_external_order_id}}.
     
    Bildschirmfoto_2022-08-16_um_16.54.09.png
     
  • Proceed with the importing using the Runner function as shown above.

 

Related resources

Was this article helpful?
1 out of 1 found this helpful

Articles in this section