API’s

Umajin Cloud Services API’s you can leverage in your applications.

Advanced Data

Umajin has advanced capabilities in the Dashboard for developers and the Dashboard can be utilized via a rest style API.

1) Advanced Feed setup

feed_basic

feed_adv

 

2) JSON-T data transformation

Sometimes we have very hierarchical data that needs to be flattened or processed so it can be used in a feed.

Video tutorial on JSON-T ( Link )

How can I transform it?

You can test transformation rules against your data here:

http://cms.umajin.com/json_transform_test.php

You can build new transformation rules with this handy helper here:

http://cms.umajin.com/json_transform_builder.php

You need to have your desired output format in mind, when transforming your input json data.

Umajin App Creator feeds use a simple flat json format.

Guidelines for what output json should look like :

  1. Square brackets around the outside of everything (indicating that this is an array/list of items)  [ ]
  2. Curly brackets around each feed item [{ }]
  3. Comma between feed items [{ },{ }]
  4. Feed Items can have properties aka name value pairs, put Semicolon between the name and value [{name1:value1},{ }]
  5. Double quotes around the name and the value [{“name1″:”value1”},{“name2″:”value2”}]
  6. Comma between name value pairs in a feed item [{“name1″:”value1”, “name1b”:”value1b”},{“name2″:”value2”}]

An Example:

In the example below the input Json data has root level properties, that we want to discard.

Then we want each of the entries in the posts array to become a feed item.

Finally we want to build up a property from the posts item’s tags array.

Example input JSON Data (This is example limited to one posts item, the real data had multiple posts items):

Example transformation rules (JSON format):

Rule tips :
– self is a shortcut for the root level of the json (in the example input {self.status} would be replaced with “ok”
– The rule name should reference a level of the input json data
– $ is a placeholder for the rule name, which is handy when hte rule name is quite long (eg self.posts[*].tags[*]),
– [*] in the rule name means execute this rule on each item in the array

Lets go through each rule :

– This is putting square brackets around everything. {posts} will be replaced with the result of the rule posts[*].

– This is the bulk of the transformation, as we want each item in the posts array to become a feed item.
– Removing the “\” escape characters and formatting it a bit, we get something a bit easier to read

– Looking at the {} tokens used :
– {$.title} really means {posts[*].title}
– {$.url} really means {posts[*].url}
– {$.custom_fields.number} really means {posts[*].custom_fields.number}, so we get the value of the number property of the custom_fields object which is a child of the posts item.
– {$.tags} will contain the output from running the “self.posts[*].tags[*]” rule.

– Note the trailing comma, so that if there are multiple posts then they will have a comma between them.

– This goes through the array of tags for each posts item, it builds up a list of the tags.title values with commas between them.

Example output from performing the transformation:

There is a final step which removes any trailing commas from both the list of tags.title values and the posts items.

3) Turning form submissions into a feed

– press the ‘share’ button to generate this API feed
– this generates a REST call like this;

– use this as a direct URL source or use it for a new feed in the Dashboard