API: Wiki Pages

The Wiki Pages API methods allow for retrieving information about wiki pages.

It's important to note that adventure log posts are just special wiki pages. They are identified by the type attribute with the value of Post.

Attributes

Public (always available)

  • id - identifier - A unique identifier for the wiki page. This will never change. (read only)
  • slug - string - A URL-friendly slug for the wiki page. The user can change this. (read only...sort of...it changes based on name)
  • name - string - The page's name. Changing this can break wiki links and is heavily discouraged.
  • wiki_page_url - string - The URL to the wiki page. (read only)
  • campaign - campaign mini-object The ID of the campaign that this wiki page belongs to. (read only)
  • created_at - timestamp - Indicates when the page was first created. ISO-8601 timestamp (read only)
  • updated_at - timestamp - Indicates when the page was last updated. ISO-8601 timestamp (read only)

Public / Private / Friends Visibility (availability depends on campaign visibility and page's GM-only status)

  • type - string - Indicates the type of wiki page. Can be one of 'WikiPage' (for basic wiki pages) or 'Post' for adventure log posts. (read only...sort of...it can be set on creation, but not changed)
  • is_game_master_only - boolean - true if this page is visibile only to the GM, false otherwise
  • body - string - The raw text of the page.
  • body_html - string - The parsed and rendered HTML for the page. (read only)
  • tags - array - A list of tags applied to this wiki page.
  • post_title - string - The name of the adventure log post. Usually the same as the page name, but not always. Only included for adventure log posts.
  • post_tagline - string - A tagline for the adventure log post. Only included for adventure log posts.
  • post_time - timestamp - The user selected posting time for the adventure log post. Only included for adventure log posts.

GM only (available only to the GM and any co-GMs)

  • game_master_info - string - The raw text of the GM Only info field.
  • game_master_info_markup - string - The parsed and rendered HTML for the GM Only info field. (read only)

Methods

Index (List)

URL: http://api.obsidianportal.com/v1/campaigns/campaign_id/wikis.format
HTTP Verb: GET
Requires Authentication: Yes
Required Parameters:

  • campaign_id - identifier - The ID of the campaign to retrieve a wiki page list from.

Optional Parameters: None
Response Code: 200
Response Body: A list of wiki pages for a campaign.

Notes

1) Missing fields
For bandwidth conservation, the data returned does not include the the body, body_html, game_master_info, game_master_info_html fields. If you need the full text, you'll have to request the pages individually.

2) Visibility breakdown
The list of pages returned depends on the visibility of the campaign and the identity of the logged in user. It breaks down as follows:

  • public campaign, non-GM - All non gm-only pages
  • public campaign, GM - All pages
  • private campaign, non-player, non-GM - HTTP 403
  • private campaign, player - All non gm-only pages
  • private campaign, GM - All pages

Example

Request

http://api.obsidianportal.com/v1/campaigns/5b6ef1e0f24411dfba8140403656340d/wikis.json

Response

[
  {
   'id' : 'c06993fcf24411dfba8140403656340d',
   'slug' : 'main-page',
   'name' : 'Main Page',
   'wiki_page_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
   'campaign' : {
    'id' : '5b6ef1e0f24411dfba8140403656340d',
    'name' : 'Kensing',
    'slug' : 'kensing',
    'campaign_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
    'banner_image_url' : 'http://cdn.obsidianportal.com/foo/bar/image.jpg',
    'visibility' : 'public'
   },
   'type' : 'WikiPage',
   'tags' : ['tag1', 'tag2'],
   'created_at' : '2007-04-24T21:42:13Z',
   'updated_at' : '2010-01-18T04:50:09Z',
   'is_game_master_only' : false
  },
  {
   'id' : 'd06993fcf24411dfba8140403656340d',
   'slug' : 'our-first-outing',
   'name' : 'Our First Outing',
   'wiki_page_url' : 'http://www.obsidianportal.com/campaigns/kensing/adventure-log/our-first-outing',
   'campaign' : {
    'id' : '5b6ef1e0f24411dfba8140403656340d',
    'name' : 'Kensing',
    'slug' : 'kensing',
    'campaign_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
    'banner_image_url' : 'http://cdn.obsidianportal.com/foo/bar/image.jpg',
    'visibility' : 'public'
   },
   'type' : 'Post',
   'post_title' : 'Our First Outing',
   'post_tagline' : 'Roll for initiative',
   'post_time' : '2007-04-24T22:00:00Z',
   'tags' : ['tag3', 'tag4'],
   'created_at' : '2007-04-24T21:42:13Z',
   'updated_at' : '2010-01-18T04:50:09Z',
   'is_game_master_only' : false
  }
 ]

Show

URL: http://api.obsidianportal.com/v1/campaigns/campaign_id/wikis/id.format
HTTP Verb: GET
Requires Authentication: Yes
Required Parameters:

  • campaign_id - identifier - The ID of the campaign to retrieve a wiki page list from.
  • id - identifier - The ID of the wiki page to retrieve. You can also use the wiki page slug (see use_slug below)

Optional Parameters:

  • use_slug - boolean - When set to 'true', or '1', the wiki page will be looked up by slug instead of id. Note: The campaign_id must be an identifier, not a slug.

Response Code: 200
Response Body: A single wiki page for a campaign.

Example

Request

http://api.obsidianportal.com/v1/campaigns/5b6ef1e0f24411dfba8140403656340d/wikis/c06993fcf24411dfba8140403656340d.json

Response

{
 'id' : 'c06993fcf24411dfba8140403656340d',
 'slug' : 'main-page',
 'name' : 'Main Page',
 'wiki_page_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
 'campaign' : {
    'id' : '5b6ef1e0f24411dfba8140403656340d',
    'name' : 'Kensing',
    'slug' : 'kensing',
    'campaign_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
    'banner_image_url' : 'http://cdn.obsidianportal.com/foo/bar/image.jpg',
    'visibility' : 'public'
   },
 'type' : 'WikiPage',
 'body' : 'Some text here...',
 'body_html' : '<p>Some text here...</p>',
 'tags' : ['tag1', 'tag2'],
 'created_at' : '2007-04-24T21:42:13Z',
 'updated_at' : '2010-01-18T04:50:09Z',
 'is_game_master_only' : false,
 'game_master_info' : 'Secret info here',
 'game_master_info_html' : '<p>Secret info here</p>'
}

Create

URL: http://api.obsidianportal.com/v1/campaigns/campaign_id/wikis.format
HTTP Verb: POST
Requires Authentication: Yes
Required Parameters:

  • campaign_id - identifier - The ID of the campaign to create a wiki page in.

Optional Parameters: None
Response Code: 201
Response Body: A single wiki page.

Example

Request

Request Body

{
 'wiki_page' : {
  'name' : 'My Newly Created Page',
  'body' : 'Body text goes here',
  'game_master_info' : 'Secrets go here',
  'is_game_master_only' : true
 }
}

Response

{
 'id' : 'e06993fcf24411dfba8140403656340d',
 'slug' : 'my-newly-created-page',
 'name' : 'My Newly Created Page',
 'wiki_page_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/my-newly-created-page',
 'campaign' : {
    'id' : '5b6ef1e0f24411dfba8140403656340d',
    'name' : 'Kensing',
    'slug' : 'kensing',
    'campaign_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
    'banner_image_url' : 'http://cdn.obsidianportal.com/foo/bar/image.jpg',
    'visibility' : 'public'
   },
 'type' : 'WikiPage',
 'body' : 'Body text goes here',
 'body_html' : '<p>Body text goes here</p>',
 'created_at' : '2010-11-01T21:42:13Z',
 'updated_at' : '2010-11-01T21:42:13Z',
 'is_game_master_only' : true,
 'game_master_info' : 'Secrets go here',
 'game_master_info_html' : '<p>Secrets go here</p>'
}

Update

URL: http://api.obsidianportal.com/v1/campaigns/campaign_id/wikis/id.format
HTTP Verb: PUT
Requires Authentication: Yes
Required Parameters:

  • campaign_id - identifier - The ID of the campaign to retrieve a wiki page from.
  • id - identifier - The ID of the wiki page to update.

Optional Parameters: None
Response Code: 200
Response Body: A single wiki page.

Example

Request

Request Body

{
 'wiki_page' : {
  'body' : 'Updates to text',
  'game_master_info' : 'New secrets here',
  'is_game_master_only' : true
 }
}

Response

{
 'id' : 'c06993fcf24411dfba8140403656340d',
 'slug' : 'main-page',
 'name' : 'Main Page',
 'wiki_page_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
 'campaign' : {
    'id' : '5b6ef1e0f24411dfba8140403656340d',
    'name' : 'Kensing',
    'slug' : 'kensing',
    'campaign_url' : 'http://www.obsidianportal.com/campaigns/kensing/wikis/main-page',
    'banner_image_url' : 'http://cdn.obsidianportal.com/foo/bar/image.jpg',
    'visibility' : 'public'
   }
 'type' : 'WikiPage',
 'body' : 'Updates to text',
 'body_html' : '<p>Updates to text</p>',
 'tags' : ['tag1', 'tag2'],
 'created_at' : '2007-04-24T21:42:13Z',
 'updated_at' : '2010-01-18T04:50:09Z',
 'is_game_master_only' : true,
 'game_master_info' : 'New secrets here',
 'game_master_info_html' : '<p>New secrets here</p>',
}

Delete

URL: http://api.obsidianportal.com/v1/campaigns/campaign_id/wikis/id.format
HTTP Verb: DELETE
Requires Authentication: Yes
Required Parameters:

  • campaign_id - identifier - The ID of the campaign to retrieve a wiki page from.
  • id - identifier - The ID of the wiki page to delete.

Optional Parameters: None
Response Code: 204
Response Body: None

Example

Request

Response