Connecting to Freightview's API
If you're a Freightview customer, you can set up integrations to access quotes via our API to a myriad of software including ERPs, E-commerce, Shopping Carts, Site Plugins, and more.
About the API
Freightview's API is considered RESTful. It uses JSON, a common and lightweight data representation that is easily consumed by most languages and frameworks. The documentation is clear and robust (check it out Here). Even if you're not a developer, this post will explain how you can test the API without writing a single line of code.
Getting started
If you've ever connected to an API before, you know that the biggest challenge is the first step: authenticating. In the same way that you log in on our website, the API needs to know who you are in order to give you back rates based on your carrier relationships. If you don't include the correct authentication with each request, all calls to the Freightview API will return a "401
Unauthorized error." Reach out to our Support Team for further assistance.
Obtaining your API key
Freightview's API requires a special key to recognize your account. You can find this key in your Account Settings, then choose "API key". More Here.
Method 1: Simple API authentication with cURL
Freightview's developer documentation provides a one-line command you can run in your terminal to ensure you can successfully connect to the API. This command is called "cURL", and it simply verifies that a URL (in this case, Freightview's API URL) gives the expected response. When you run this command, along with your API key, you should get a 200 OK response like the one shown here. Notice the trailing colon (:) after the API key. This tells cURL that the password is empty.
Method 2: Simple API authentication with Postman
cURL is great, but some folks prefer a nice user interface to interact with instead. The gold standard for testing APIs is a free and cross-platform application called Postman. You can get it at https://www.getpostman.com.
As you can see in the screenshot below, you'll provide all of the same information as you would with cURL, but you enter it in Postman's fields. Again, the password field is empty. The result should be the same: a 200 OK response.
- Ensure the method is GET.
- Enter the authenticated URL.
- On the Authorization tab, choose Basic Auth in the dropdown, and enter your API key for the Username.
- Hit Send.
Further testing
The methods above allow you to ensure the Freightview API is up, reachable, and successfully authenticating your account. If you want to take things further, you can use Postman to do a few rate requests, just like you would on the website.
- Change the method from GET to POST.
- Replace "authenticate" with "rates" in the URL.
- On the Headers tab, add a Content-Type header with "application/json" as the value. (You can leave the Authorization header alone).
- On the Body tab, choose "raw" and build your JSON request according to the documentation.
- Hit Send.
Successful responses will once again return a 200 OK response, along with an array of quotes.f you get an error, check the response documentation for the corresponding HTTP status code (e.g. 400, 500) for that endpoint.
Notice that endpoints like /rates are versioned. You may specify a version in the URL using this format: https://www.freightview.com/api/v1.0/rates. If you do not specify a version, it will default to version 1.0.
They're your rates, use them your way
At Freightview, we strive to make every aspect of your shipping needs easier; whether you're using our website or a complementary tool. Our API makes it easy to see and use your rates however you need them. And of course, we're here to help if you have questions or comments. Happy shipping!
This post was updated on August 10th, 2023
Contact our Support Team for further questions & assistance.