Using the FreeAgent API with Curl

Getting started is easy. First, get an Access Token.

Open a terminal and paste in the following command, replacing TOKEN with the Access Token:

curl \
  -H "Authorization: Bearer TOKEN" \
  -H "Accept: application/xml" \
  -H "Content-Type: application/xml" \
  -X GET 

You should see the response:

<?xml version="1.0" encoding="UTF-8"?>
    <name>My Company</name>
    <company-start-date type="date">2010-05-01</company-start-date>
    <freeagent-start-date type="date">2010-05-01</freeagent-start-date>
    <first-accounting-year-end type="date">2010-05-01</first-accounting-year-end>

By modifying the above command you can access all of the FreeAgent API.

To use the sandbox API change the server in the examples above to:

To use JSON instead of XML change application/xml to application/json

Learn more about the FreeAgent API