GET /markets.xml?params
Admin sorts:
General user sorts:
Note the difference in the sorts above between the groups (my, my_resolved, pending, submitted, expired) and (recent, expiring, active, closed). The first group pulls back records that "belong" to the user or admin. If the user is an admin it includes all the markets created on the site. If the user isn't an admin, the markets pulled back are only markets they have created.
The second group pulls back records that are public or that they have been invited to. If an admin account uses the web service with the second group of sorts, they will not see private markets that they haven't been invited to.
curl -u username:password http://subdomain.inklingmarkets.com/markets.xml?sort=recent
<?xml version="1.0" encoding="UTF-8"?>
<markets type="array">
<options>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>first_market</description>
<ends-at type="datetime">2008-06-23T21:13:26-07:00</ends-at>
<exclusive type="boolean">true</exclusive>
<id type="integer">1</id>
<name>first_market</name>
<updated-at type="datetime">2008-06-15T21:13:26-07:00</updated-at>
<membership>
<id type="integer">799466675</id>
</membership>
<stocks type="array">
<stock>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>First stock description</description>
<id type="integer">1</id>
<name>First stock</name>
<price type="integer">10</price>
<price-before-resolution type="integer">10</price-before-resolution>
<refunded type="boolean" nil="true"></refunded>
<resolved-at type="datetime" nil="true"></resolved-at>
<starting-price type="integer">10</starting-price>
<symbol>FSD</symbol>
</stock>
<stock>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>Another stock description</description>
<id type="integer">2</id>
<name>First stock</name>
<price type="integer">10</price>
<price-before-resolution type="integer">10</price-before-resolution>
<refunded type="boolean" nil="true"></refunded>
<resolved-at type="datetime" nil="true"></resolved-at>
<starting-price type="integer">10</starting-price>
<symbol>FSD</symbol>
</stock>
</stocks>
</options>
<futures>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>futures_market</description>
<ends-at type="datetime">2008-06-23T21:13:26-07:00</ends-at>
<exclusive type="boolean" nil="true"></exclusive>
<id type="integer">2002</id>
<name>futures_market</name>
<updated-at type="datetime">2008-06-15T21:13:26-07:00</updated-at>
<membership>
<id type="integer">799466675</id>
</membership>
<stocks type="array">
<stock>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>Hunderd dollar stock description</description>
<id type="integer">5</id>
<name>Hundred Dollar Stock</name>
<price type="integer">10000</price>
<price-before-resolution type="integer">10000</price-before-resolution>
<refunded type="boolean" nil="true"></refunded>
<resolved-at type="datetime" nil="true"></resolved-at>
<starting-price type="integer">10000</starting-price>
<symbol>HDS</symbol>
</stock>
<stock>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>Stock with Position</description>
<id type="integer">6</id>
<name>Stock with Position</name>
<price type="integer">10100</price>
<price-before-resolution type="integer">10100</price-before-resolution>
<refunded type="boolean" nil="true"></refunded>
<resolved-at type="datetime" nil="true"></resolved-at>
<starting-price type="integer">10000</starting-price>
<symbol>SWP</symbol>
</stock>
</stocks>
</futures>
</markets>
Each market question returned will be of type:
A reference for some of the fields seen here:
GET /markets/:market_id.xml
curl -u username:password http://subdomain.inklingmarkets.com/markets/123.xml
<?xml version="1.0" encoding="UTF-8"?>
<options>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>first_market</description>
<ends-at type="datetime">2008-06-23T21:13:26-07:00</ends-at>
<exclusive type="boolean">true</exclusive>
<id type="integer">1</id>
<name>first_market</name>
<updated-at type="datetime">2008-06-15T21:13:26-07:00</updated-at>
<membership>
<id type="integer">799466675</id>
</membership>
<stocks type="array">
<stock>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>First stock description</description>
<id type="integer">1</id>
<name>First stock</name>
<price type="integer">10</price>
<price-before-resolution type="integer">10</price-before-resolution>
<refunded type="boolean" nil="true"></refunded>
<resolved-at type="datetime" nil="true"></resolved-at>
<starting-price type="integer">10</starting-price>
<symbol>FSD</symbol>
</stock>
<stock>
<created-at type="datetime">2008-06-15T21:13:26-07:00</created-at>
<description>Another stock description</description>
<id type="integer">2</id>
<name>First stock</name>
<price type="integer">10</price>
<price-before-resolution type="integer">10</price-before-resolution>
<refunded type="boolean" nil="true"></refunded>
<resolved-at type="datetime" nil="true"></resolved-at>
<starting-price type="integer">10</starting-price>
<symbol>FSD</symbol>
</stock>
</stocks>
</options>
POST /markets.xml
curl \ -u username:password \ -H 'Content-Type: application/xml' \ -d "<market> \ <name>Which team will win the World Series?</name> \ <ends-at>2008-05-05T02:20:30-05:00</ends-at> \ <class-type>Exclusive</class-type> \ <tag-list>sports baseball</tag-list> \ </market>" \ http://subdomain.inklingmarkets.com/markets.xml
Status: 201 Created Location: http://subdomain.inklingmarkets.com/markets/:market_id.xml <market> ... </market>
PUT /markets/:market_id.xml
curl \ -u username:password \ -H 'Content-Type: application/xml' \ -X PUT \ -d "<market> \ <name>Which team will win the 2008 World Series?</name> \ </market>" \ http://subdomain.inklingmarkets.com/markets/:market_id.xml
Status: 200 OK
DELETE /markets/:market_id.xml
curl \ -u username:password \ -H 'Content-Type: application/xml' \ -X DELETE \ http://subdomain.inklingmarkets.com/markets/:market_id.xml
Status: 200 OK
POST /markets/:market_id/publications.xml
curl \ -u username:password \ -H 'Content-Type: application/xml' \ -X POST \ http://subdomain.inklingmarkets.com/markets/:market_id/publications.xml
Response: Status: 201 Created Location: http://subdomain.inklingmarkets.com/markets/:market_id.xml <market> ... </market>
We would love to hear from you. Contact us with questions or comments.