Edmunds API

This tutorial shows how to configure a remote web service to connect to the Edmunds Vehicle API. It shows how to pass parameters like API keys and format options to the remote service. The ones in this example are specific to the Edmunds API, but many APIs have similar concepts.

Create the Remote Web Service

In the admin console, go to the Services tab and click Create.
Set the Service Type to 'Remote Web Service'.
Set the service name to 'edmunds'.
Set the service label to 'Edmunds API'.
Go to the Config tab for the new service and set the Base URL to ```https://api.edmunds.com/api/vehicle/v2/```.
Click the '+' button under Parameters to add a new parameter.
Set the name to 'fmt' and the value to 'json'.
Check the 'Outbound' checkbox so that your DreamFactory instance will pass the parameter through to the Edmunds API.
Select all verbs so that the parameter is sent to the Edmunds API for all requests.
Add a second parameter. Set the name to 'api_key' and the value to your API key issued from the Edmunds developer portal.
Check the 'Outbound' checkbox and all verbs.
Click Create Service to save your new service.

Call the Remote Web Service

You can now use any REST client to access your remote web service using the DreamFactory REST API. To get a list of new vehicle makes and models for 2015 you would send the following request. Replace http://localhost:8080 with the URL for your DreamFactory instance.

GET http://localhost:8080/api/v2/edmunds/make?state=new&year=2015&view=basic

DreamFactory combines the request URL from the client with the configured base URL for the service to generate the actual URL for the request. Everything after the service name, 'edmunds' in this case, is appended to the base URL to generate the final URL.

GET https://api.edmunds.com/api/vehicle/v2/make?state=new&year=2015&view=basic&fmt=json&api_key=xxxxxxxxxxxxx

DreamFactory also appends the fmt and api_key parameters before sending the request on to the Edmunds API. This ensures that your API key or other sensitive information is never exposed to the client app. The response will be in JSON format. It has been shortened here for the sake of clarity.