Summer in Germany has been rainy so far, giving us time to hack.

Read on for API Updates, Order object improvements and our New HOT JSON Schema Builder 

API Updates

We took the time to do a long outstanding chore, by adding field length restrictions to all relevant fields.

Plain text-fields, marked with „format“:“text“, have their own restriction: their length varies between ~16,000 to 65.535, depending on the occurence of non-ASCII Characters.
See this thread on stackoverflow

If you submit payments, please check your code, as we deprecated the use of payment.method in favour of payment.payment_method.
More in our changelog

Orders

The Order object now supports due date and due days, aligning it with the other document types. In case you don’t want orders to be due in the future, simply leave those fields blank.
Like in other documents, the date field or if empty the current date, is used, when the order is opened.

JSON Schema Bilder

JSON Schema, as the base for any API description, has proven its usefulness not only in SalesKing. But writing it from scratch can be annoying, so we hacked a tiny ruby gem providing a jump start.

https://github.com/salesking/json_schema_builder

Hook the gem into your rails 3 Gemfile and run the rake task:

gem „json_schema_builder“
rake schema:build

The gem walks through the ActiveRecord models and their respective routes. For each model the database fields and the resource links are written to a json schema file. As said, it’s just a quick start, as you might want to add, remove fields, edit descriptions and check links.

We are working on more tools on top of this, to simplify the creation of API’s. Just think of modeljson or /api controllers. For a sneak peak of how to work with Schema files, take a look at our own handling:

https://github.com/salesking/sk_api_schema/blob/master/lib/sk_api_schema.rb#L67

Thanks for using SalesKing,

George