Online documentation

Hi,****


I’m working on some Haskell bindings to freeagent and as part of this I’ve
been experimenting with auto generating the Haskell types from the json
embedded in your online documentation (quite a fun little project).****


I’ve run into a little problem, in that the responses I get have different
fields to those documented. For example, the response for company (
https://dev.freeagent.com/docs/company) has 4 extra fields in addition to
the 12 mentioned in the documentation. (I can’t remember what they are
offhand and I haven’t pushed my code to github yet, sorry). I’d also
comment that there are quite a few fields that seem to be encoded as
strings which actually look more like numbers e.g. current_balance on bank
accounts.****


I have a plan to work around this, but I thought I’d let you know. I’ll
ping you again when I’ve got the project into a usable state - unless
you’ve got any Haskell hackers working there who’s like to join in J?****


Thanks,****

Ben Ford

Hi Jonathan,

I was getting quite a few errors with my old approach. One example is:

{
“company”: {
“company_registration_number”: “xxx”,
“company_start_date”: “2013-03-19”,
“currency”: “GBP”,
“first_accounting_year_end”: “2014-03-31”,
“freeagent_start_date”: “2013-03-19”,
“mileage_units”: “miles”,
“name”: “xxxx”,
“sales_tax_is_value_added”: true,
“sales_tax_name”: “VAT”,
“sales_tax_rates”: [
“0.0”,
“5.0”,
“15.0”,
“17.5”,
“20.0”
],
“sales_tax_registration_number”: “xxxx”,
“sales_tax_registration_status”: “Registered”,
“subdomain”: “xxxx”,
“supports_auto_sales_tax_on_purchases”: true,
“type”: “UkLimitedCompany”,
“url”: “https://api.freeagent.com/v2/company
}
}

This has 4 extra fields (“sales_tax_name”,
“support_auto_sales_tax_on_purchases”, “sales_tax_is_value_added” and
“sales_tax_rates”) compared to the online docs of:

{ “company”:
{
“url”:“https://api.freeagent.com/v2/company”,
“name”:“My Company”,
“subdomain”:“mycompany”,
“type”:“UkLimitedCompany”,
“currency”:“GBP”,
“mileage_units”:“miles”,
“company_start_date”:“2010-05-01”,
“freeagent_start_date”:“2010-05-01”,
“first_accounting_year_end”:“2011-05-01”,
“company_registration_number”:“123456”,
“sales_tax_registration_status”:“Registered”,
“sales_tax_registration_number”:“123456”
}}

I had a few other errors which I seem to have mitigated now by using a
different approach to generating my types. I’ll be adding a test suite for
the generated types now that they compile and I will let you know if there
are any that are a bit off.

The other issue is that of fields that are encoded as strings that look
like they really should be numbers. There are quite a few of these, off the
top of my head:

bank_account: current_balance, opening_balance
bill : most fields
expenses : most fields

It’s not a huge deal as I can write some code to fix this as and when I
need to now that my types have been generated, but I thought I’d let you
know.

Thanks,
BenOn Tuesday, June 18, 2013 9:49:18 AM UTC+1, Jonathan Barrett wrote:

Hi Ben,

Thanks for the feedback. If you can let me know what fields you’re seeing,
I’ll take a look and see if the documentation needs to be updated or
clarified.

Cheers,

-J

On Tuesday, 18 June 2013 05:36:20 UTC+1, b...@perurbis.com wrote:

Hi,****


I’m working on some Haskell bindings to freeagent and as part of this
I’ve been experimenting with auto generating the Haskell types from the
json embedded in your online documentation (quite a fun little project).*



I’ve run into a little problem, in that the responses I get have
different fields to those documented. For example, the response for company
(FreeAgent Developer Dashboard) has 4 extra fields in addition
to the 12 mentioned in the documentation. (I can’t remember what they are
offhand and I haven’t pushed my code to github yet, sorry). I’d also
comment that there are quite a few fields that seem to be encoded as
strings which actually look more like numbers e.g. current_balance on bank
accounts.****


I have a plan to work around this, but I thought I’d let you know. I’ll
ping you again when I’ve got the project into a usable state - unless
you’ve got any Haskell hackers working there who’s like to join in J?****


Thanks,****

Ben Ford

Hi Ben,

Thanks for the feedback. If you can let me know what fields you’re seeing,
I’ll take a look and see if the documentation needs to be updated or
clarified.

Cheers,

-JOn Tuesday, 18 June 2013 05:36:20 UTC+1, b...@perurbis.com wrote:

Hi,****


I’m working on some Haskell bindings to freeagent and as part of this I’ve
been experimenting with auto generating the Haskell types from the json
embedded in your online documentation (quite a fun little project).****


I’ve run into a little problem, in that the responses I get have different
fields to those documented. For example, the response for company (
FreeAgent Developer Dashboard) has 4 extra fields in addition to
the 12 mentioned in the documentation. (I can’t remember what they are
offhand and I haven’t pushed my code to github yet, sorry). I’d also
comment that there are quite a few fields that seem to be encoded as
strings which actually look more like numbers e.g. current_balance on bank
accounts.****


I have a plan to work around this, but I thought I’d let you know. I’ll
ping you again when I’ve got the project into a usable state - unless
you’ve got any Haskell hackers working there who’s like to join in J?****


Thanks,****

Ben Ford