Skip to content

Instantly share code, notes, and snippets.

@cblunt
Last active December 17, 2015 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cblunt/5690036 to your computer and use it in GitHub Desktop.
Save cblunt/5690036 to your computer and use it in GitHub Desktop.
Notes from working with the FreeAgent API

Sample

{ "expense":
  {
    "user":"https://api.freeagent.com/v2/users/93049",
    "category":"https://api.freeagent.com/v2/categories/249",
    "dated_on":"2013-05-08",
    "gross_value":"-100.0", # Note required if a mileage expense
    "sales_tax_rate":"20.0",
    "description":"TEST expense from API",
    
    "project": "https://api.freeagent.com/v2/projects/392390",
    "rebill_type": "cost",

    "vehicle_type": "Car",
    "mileage": "100",
    "reclaim_mileage": "1",
    "have_vat_receipt": "1",
    "engine_type_index": 2,
    "engine_size_index": 1,
    "rebill_mileage_rate": 2.50
  }
}

Mileage

mileage 50 Miles to reclaim (Required for mileage expenses)

reclaim_mileage 0 Do not reclaim 1 Reclaim at AMAP Rate

Mileage VAT

have_vat_receipt 0 Do not reclaim VAT 1 Have VAT Receipt

vehicle_type Car Motorcycle Bicycle

engine_type_index 0 Petrol 1 Diesel 2 LPG

engine_size_index

(engine_type = 0 Petrol)
    0         Up to 1400
    1         1401-2000
    2         Over 2000

(engine_type = 1 Diesel)
    0         Up to 1600
    1         1601-2000
    2         Over 2000

(engine_type = 2 LPG)
    0         Up to 1400
    1         1401-2000
    2         Over 2000

rebill_mileage_rate 1.50 Rebill at £1.50 per mile

Rebilling

`project`         null        Do not associate with project.
                              In this case, rebill_type and rebill_factor are invalid if set

                  {url}       URL of the project.

`rebill_type`     null        Do not rebill
                  "cost"      Rebill at cost (only option for mileage)
                  "markup"    Rebill at %age markup (rebill_factornt becomes %age) 
                  "price"     Rebill at price (rebill_factor becomes price)

`rebill_factor`   null        Do not rebill (invalid if rebill_type is "markup" or "price")
                  number      Rebill at given value (depends on rebill_type) mark
@fawkesley
Copy link

Thanks, this was helpful. If you had any tips on how you do token refreshes, that'd be great too!

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