Skip to content

Instantly share code, notes, and snippets.

@barelyknown
Last active December 10, 2015 01:38
Show Gist options
  • Select an option

  • Save barelyknown/4360301 to your computer and use it in GitHub Desktop.

Select an option

Save barelyknown/4360301 to your computer and use it in GitHub Desktop.
Partage API Documentation

THE LATEST VERSION OF THIS DOCUMENTATION IS AVAILABLE AT gopartage.com/api.

Partage API

The Partage API provides a simple limited interface to the Partage brokerage system.

Authentication

For now, authentication is done with an API token that is connected to your company. We will add additional and more secure authentication options later in 2013 when we expose more services. For now, the services are "read only" and do not enable you to make any changes in our system, so we delayed our decision about additional security until we need to make it.

If you do not have an API token for your company, send an email to [email protected] with a very brief description of what you plan to build.

Create Quote

POST http://www.gopartage.com/api/quotes will create a new quote from the parameters passed.

Acceptable equipment types are van, flatbed, and refrigerated.

Request

{
  "api_token":"...",
  "quote":{
    "equipment":"van",
    "origin_postal_code":"60612",
    "destination_postal_code":"12186"
  }
}

Response

In addition to echoing the request parameters, the response includes:

  • Number: Used to reference the quote with Partage.
  • URL: Location of the quote in the Partage system.
  • Miles: The miles that Partage used to calculate the rate.
  • Options: One for each mode that is offered (truckload, partial_truckload and intermodal).
  • Terms: Some of the important terms and conditions that apply to the rate quote.
  • Weight: Note that if weight is not provided, the weight that is returned will be the default maximum of 45,000.
  • Pallet Spots: Note that if pallet spots are not provided, the weight that is returned will be the default maximum of 26.
{
  "quote":{
    "number":"2012-12-25-1",
    "url":"http://www.gopartage.com/companies/.../quotes/...",
    "terms":"...",
    "equipment":"van",
    "origin_postal_code":"12186",
    "destination_postal_code":"60612",
    "weight":45000,
    "pallet_spots":26,
    "miles":810,
    "options":[
      {
        "mode":"truckload",
        "total":1575
      },
      {
        "mode":"intermodal",
        "total":1212
      }
    ]
  },
  "documentation": "http://www.gopartage.com/api"
}

If you'd like a partial truckload option as well, include the weight and pallet spots.

{
  "api_token":"...",
  "quote":{
    "equipment":"van",
    "origin_postal_code":"60612",
    "destination_postal_code":"12186",
    "weight": 10000,
    "pallet_spots": 10
  }
}

If your company has sub-companies (branches, franchises, etc) in the Partage system, you can create the quotes for them by supplying an external_id parameter.

{
  "api_token":"...",
  "external_id":"sub-company id",
  "quote":{
    "equipment":"van",
    "origin_postal_code":"60612",
    "destination_postal_code":"12186",
    "weight": 10000,
    "pallet_spots": 10
  }
}  

You can set the unique external_ids for your sub-companies on http://www.gopartage.com by editing the their profile.

If you provide an external_id, you will receive an error if a child company is not found for your company with the external_id.

Show Quote

Request

GET http://www.gopartage.com/api/quotes/:id?api_token=... will get you the data of the quote for the passed id. You can use the number or pl_id fields as :id

Response

The response includes:

  • Number: Used to reference the quote with Partage.
  • Length
  • Weight
  • Pallets
  • Pallet Spots
  • Equipment Type
  • Rate: The booked rate with its total, who booked it, its charges, notes and the invoice
  • Carrier: Information about the booked carrier and who booked it
  • Shipments: The shipments containing the load with its information and notes
  • Stops: The stops of the quote with information about which shipment is involved in the stop, what type it is (pickup, drop), the location, window, schedule, notes and proof of delivery (only drop stop)
  • Special Services: Show all special services booked to the load
{
  "quote":{
    "pl_id":"PLWSC6",
    "number":"2012-08-22-100",
    "length":8,
    "weight":6792,
    "pallet_spots":4,
    "pallets":4,
    "equipment_type":"Van",
    "rate":{
      "booked_at":"2012-08-22T18:20:21Z",
      "booked_by":{
        "name":"Name of Customer User",
        "email":"Email of Customer User"
      },
      "total":300,
      "charges":[
        {
          "name":"Linehaul",
          "total":582,
          "unit_of_measure":"Mile",
          "units":534.7
        },
        {
          "name":"Consolidation",
          "total":-555,
          "unit_of_measure":"Dollar",
          "units":855
        },
        {
          "name":"Fuel",
          "total":273,
          "unit_of_measure":"Mile",
          "units":534.7
        },
        {
          "name":"Delay Time",
          "total":800,
          "unit_of_measure":"Day",
          "units":4.0
        }
      ],
      "notes":[
        {
          "content":"Call For Appointment",
          "user":{
            "name":"Name of User",
            "company":"Name of Company"
          },
          "attachment_url":null,
          "created_at":"2012-08-22T18:20:19Z"
        }
      ],
      "invoice":{
        "due_date":"2012-11-12",
        "adjustment":0,
        "total":300.0,
        "balance":300.0,
        "created_at":"2012-08-29T17:10:55Z",
        "approved_by":{
          "name":"Name of Partage User"
        },
        "approved_at":"2012-11-06T22:33:19Z",
        "notes":[
          {
            "content":"W220999016",
            "user":{
              "name":"Name of User",
              "company":"Name of Company"
            },
            "attachment_url":null,
            "created_at":"2012-11-06T22:33:13Z"
          }
        ]
      }
    },
    "carrier":{
      "name":"Name of Carrier",
      "mc_number":"MC...",
      "dot_number":"...",
      "covered_at":"2012-08-23T16:04:09Z",
      "booked_by":{
        "name":"Name of Partage User",
        "email":"Email of Partage User"
      }
    },
    "shipments":[
      {
        "id":20377,
        "weight":6792,
        "pallet_spots":4,
        "pallets":4,
        "commodity":"BBQ Sauce",
        "notes":[]
      }
    ],
    "stops":[
      {
        "shipments":[
          {
            "id":20377
          }
        ],
        "type":"pick",
        "location":{
          "street":"920 CABLE ROAD",
          "city":"KANSAS CITY",
          "state":"MO",
          "postal_code":"64116"
        },
        "window":{
          "start_at":"2012-08-23T13:00:00Z",
          "end_at":"2012-08-23T20:00:00Z"
        },
        "schedule":{
          "arrived_at":"2012-08-23T17:00:00Z",
          "departed_at":"2012-08-23T19:00:00Z"
        },
        "notes":[
          {
            "content":"PICK UP #023EKC414514",
            "user":{
              "name":"Name of User",
              "company":"Name of Company"
            },
            "attachment_url":null,
            "created_at":"2012-08-23T16:21:09Z"
          }
        ]
      },
      {
        "shipments":[
          {
            "id":20377
          }
        ],
        "type":"drop",
        "location":{
          "street":"5151 AMERICAN WAY ",
          "city":"MEMPHIS",
          "state":"TN",
          "postal_code":"38115"
        },
        "window":{
          "start_at":"2012-08-29T16:00:00Z",
          "end_at":"2012-08-29T16:00:00Z"
        },
        "schedule":{
          "arrived_at":"2012-08-29T12:10:00Z",
          "departed_at":"2012-08-29T16:00:00Z"
        },
        "notes":[
          {
            "content":"Call For Appointment",
            "user":{
              "name":"Name of User",
              "company":"Name of Company"
            },
            "attachment_url":null,
            "created_at":"2012-08-22T18:20:10Z"
          }
        ],
        "proof_of_delivery": {
          "attachment_url": "https://s3.amazonaws.com/a_pod_file.pdf?AWSParams=some",
          "created_at": "2013-10-25T15:54:19Z"
        }
      }
    ],
    "special_services":[]
  }
}

Note: The Proof of Delivery is attached in its own proof_of_delivery field only for loads created after 09-18-2013. For prior loads it is attached as a note attachment on the drop stop.

Exception Handling

If there are any exceptions encountered, you will receive a status code in the 400 or 500 range, depending on the problem.

  • Authorization: 401
  • Invalid Request Format: 412
  • Invalid Quote: 406
  • Internal Application Error: 500

You will also receive a response describing the exception in the following format.

{
  "errors":["Invalid token. Company not found."]
}

Performance

Expect responses to take from 3 to 10 seconds, depending on system load and calculation complexity.

Curl Examples

Anxious to get something working? Just add your api_token to these curl requests and you should receive a successful response.

Building a quote

curl http://www.gopartage.com/api/quotes -v -H "Content-type: application/json" -X POST -d '{"api_token":"...","quote":{"destination_postal_code":"60654","equipment":"refrigerated","origin_postal_code":"12186"}}'

curl http://www.gopartage.com/api/quotes -v -H "Content-type: application/json" -X POST -d '{"api_token":"...","quote":{"destination_postal_code":"60654","equipment":"van","origin_postal_code":"12186","weight":10000,"pallet_spots":10}}'

Retrieving a quote

Add the quote's number as :id to fetch your quote curl http://www.gopartage.com/api/quotes/:id?api_token=... -v -H "Content-type: application/json"

@getaaron
Copy link

This is awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment