Implementation

The in2Era Web Service has been designed to be as easy to use as possible. Through its RESTful API, you can access information about each Product, and their respective Items, and embed an Item (interactive book, game, or other activity) into a page on your site with only one line of code!

Note: See the Setting up your site section for more information about Products and Items.

Product and Item Information

The API gives you access to all of the information you might need about each Product and Item available on the in2Era Web Service. This is static information that will only be updated when new Products and Items are added. To increase performance, it is recommended that you cache this information locally, or parse and store it in your Product and Item models. Distributors will be informed by Era Publications when new Products and/or Items are added so that you can update this information.

Products List

View a list of all Products with the following information:

All of the above information is available in XML and JSON format (replace .xml with .json), and can be accessed at the following URL:

http://dev.in2era-web-service.com/api/products.xml

This will return a list of Products:

<?xml version="1.0" encoding="utf-8"?>
<products>
  <product>
    <id>wings-online</id>
    <name>WINGS Online</name>
    <description>WINGS Online is an online series of levelled guided readers. Children can listen, read, draw and interact with their favourite books online in a fun and educational environment.</description>
    <item_count>73</item_count>
    <copyright>Copyright (c) 2008 Era Publications. All rights reserved.</copyright>
  </product>
  ...
  ...
  ...
</products>

Items List

View a summary of the selected Product, including a list of all of its Items, with the following information:

All of the above information is available in XML and JSON format, and can be accessed at the following URL:

Note: Replace [PRODUCT_ID] in the examples below with the ID of the Product that you wish to view.

Example: If we wanted to get the Product and Item information for 'WINGS Online', we would call:

http://dev.in2era-web-service.com/api/products/wings-online.xml

This will return:

<?xml version="1.0" encoding="utf-8"?>
<product>
  <id>wings-online</id>
  <name>WINGS Online</name>
  <description>WINGS Online is an online series of levelled guided readers. Children can listen, read, draw and interact with their favourite books online in a fun and educational environment.</description>
  <item_count>73</item_count>
  <copyright>Copyright (c) 2008 Era Publications. All rights reserved.</copyright>
  <items>
    <item>
      <id>01-01-fruitsalad</id>
      <title>Fruit Salad</title>
      <author>Jill McDougall</author>
      <illustrator>Martin Smith</illustrator>
      <description>How do you make fruit salad? This book shows you how.</description>
      <reading_level>RR Level 1</reading_level>
      <text_type>nonfiction</text_type>
      <cover_image>http://dev.in2era-web-service.com/files/images/covers/01-01-fruitsalad.jpg</cover_image>
      <copyright>
        <text>Text Copyright (c) 2002 Jill McDougall.</text>
        <illustrations>Illustrations Copyright (c) 2002 Martin Smith.</illustrations>
        <publisher>First published online 2008. Copyright and all rights reserved by Era Publications.</publisher>
      </copyright>
    </item>
    ...
    ...
    ...
  </items>
</product>

Show Item

View a summary of the selected Item, with the following information:

All of the above information is available in XML and JSON format, and can be accessed at the following URL:

Note: Replace [PRODUCT_ID] and [ITEM_ID]n the examples below with the ID of the Product and Item that you wish to view.

http://dev.in2era-web-service.com/api/products/[PRODUCT_ID]/items/[ITEM_ID].xml

Example: If we wanted to get the information about the Item 'Six Little Chicks' in the Product 'WINGS Online', we would call:

http://dev.in2era-web-service.com/api/products/wings-online/items/0607-49-sixlittlechicks.xml

This will return:

<?xml version="1.0" encoding="utf-8"?>
<item>
  <id>0607-49-sixlittlechicks</id>
  <title>Six Little Chicks</title>
  <author>Rodney Martin</author>
  <illustrator>Deborah Baldassi</illustrator>
  <description>The little chicks are very hungry. Where is mother hen? What will they get to eat?</description>
  <reading_level>RR Level 7</reading_level>
  <text_type>fiction</text_type>
  <cover_image>http://dev.in2era-web-service.com/files/images/covers/0607-49-sixlittlechicks.jpg</cover_image>
  <copyright>
    <text>Text Copyright (c) 2002 Rodney Martin.</text>
    <illustrations>Illustrations Copyright (c) 2002 Deborah Baldassi.</illustrations>
    <publisher>First published online 2008. Copyright and all rights reserved by Era Publications.</publisher>
  </copyright>
</item>

Embedding Items

Embedding an Item into a page on your website requires 3 pieces of information:

Then, include the following JavaScript element in your page template where you would like the item to appear.

<script type="text/javascript" src="http://dev.in2era-web-service.com/api/products/[PRODUCT_ID]/items/[ITEM_ID]/[DISTRIBUTOR_KEY]"></script>

Example: If we wanted to show the Item 'Six Little Chicks' from the 'WINGS Online' Product. Using our distributor key (d3486ae9136e7856bc42212385ea797094475802), we would include the following in our page template:

Note: This is a non-functioning example as the Distributor Key used is not valid. Please contact us to obtain your own unique Distributor Key.

<script type="text/javascript" src="http://dev.in2era-web-service.com/api/products/wings-online/items/0607-49-sixlittlechicks/d3486ae9136e7856bc42212385ea797094475802"></script>

This will insert all necessary markup into the DOM to show the interactive book. All html and JavaScript inserted into the page will be prefixed with 'in2era_' to help prevent namespace problems.

Each Item must be embedded individually. Therefore, if a specific Item is not required by the distributor, you may choose to not embed that Item.

Era suggests that you create a template page (one per Product) for displaying Items. You may then provide links to this page, passing the Item's ID as a URL parameter which causes the template to display the desired Item. Specific implementation, however, is up to you and will depend on your individual circumstances.