API: Dynamic Sheet Templates

The Dynamic Sheet Template methods allow for retrieving and modifying DSTs. If you'd like to know more about DSTs, read the guide.

"Submitted" attributes

The DSTs have to be approved before they are live on the site for everyone. This necessitates two separate copies of the DST - the approved and unapproved copy.

This is represented in the system as the "real" DST (html_template, css, javascript) and the "submitted" DST (html_template_submitted, css_submitted, javascript_submitted). When modifying a DST, the author can only modify the submitted attributes, never the real ones. Once the author is happy with their DST, they can submit it for review. Upon acceptance, the submitted values are automatically copied over to the real values.

In terms of the API, this means that API clients can only modify the XXX_submitted fields. Once the DST is ready for review, call the submit method to submit it for review.

Attributes

Public (always available)

  • id - identifier - A unique identifier for the DST. This will never change. (read only)
  • slug - string - A URL-friendly slug for the DST. The user can change this. (read only)
  • name - string - The DST's name. Changing this can confuse users and is discouraged.
  • user - user mini-object - The DST's author/owner. (read only)
  • game_system - game system mini-object - The game system this DST is for. (read only)
  • html_template - string - The HTML template portion of the DST. (read only)
  • css - string - The CSS portion of the DST. (read only)
  • javascript - string - The Javascript portion of the DST. (read only)
  • state - string - The current state of the DST. Can be one of "new", "submitted", "approved", "resubmitted", "modification_required" (read only)
  • created_at - timestamp - Indicates when the campaign was first created. ISO-8601 timestamp
  • updated_at - timestamp - Indicates when the campaign was last updated. ISO-8601 timestamp

Author only (available only to the DST author)

  • html_template_submitted - string - The submitted HTML template.
  • css_submitted - string - The submitted CSS.
  • javascript_submitted - string - The submitted Javascript.

Methods

Index (List)

URL: http://api.obsidianportal.com/v1/dynamic_sheet_templates.format
HTTP Verb: GET
Requires Authentication: Yes
Required Parameters: None
Optional Parameters: None
Response Code: 200
Response Body: A list of all the DSTs.

Notes

Missing fields
For bandwidth conservation, the data returned does not include the the html_template, css, javascript, html_template_submitted, css_submitted, and javascript_submitted fields. If you need the full text, you'll have to request the DSTs individually.

Example

Request

http://api.obsidianportal.com/v1/dynamic_sheet_templates.json

Response

{
 [
  {
   'id' : 'c06993fcf24411dfba8140403656340d',
   'slug' : 'micah_dnd_35e',
   'name' : 'Micah DnD 3.5e',
   'user' : {
    'id' : '5b6ef1e0f24411dfba8140403656340d',
    'username' : 'Micah',
    'profile_url' : 'http://www.obsidianportal.com/profile/Micah',
    'avatar_image_url' : 'http://cdn.obsidianportal.com/foo/bar/myface.jpg"
   },
   'game_system' : {
    'id' : 'd06993fcf24411dfba8140403656340d',
    'name' : 'DnD 3.5'
   },
   'state' : 'submitted'
  },
  {
   'id' : 'd06993fcf24411dfba8140403656340d',
   'slug' : 'chainsaw_xiv_dnd_4e',
   'name' : 'ChainsawXIV DnD 4e',
   'user' : {
    'id' : '6b6ef1e0f24411dfba8140403656340d',
    'username' : 'ChainsawXIV',
    'profile_url' : 'http://www.obsidianportal.com/profile/ChainsawXIV',
    'avatar_image_url' : 'http://cdn.obsidianportal.com/foo/bar/chainsaw.jpg"
   },
   'game_system' : {
    'id' : 'e06993fcf24411dfba8140403656340d',
    'name' : 'DnD 4e'
   },
   'state' : 'approved'
  }
 ]
}

Show

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

  • id - identifier - The ID of the DST to retrieve. You can also use the DST slug (see use_slug below)

Optional Parameters:

  • use_slug - boolean - When set to 'true', or '1', the DST will be looked up by slug instead of id.

Response Code: 200
Response Body: A single DST.

Example

Request

http://api.obsidianportal.com/v1/dynamic_sheet_templates/c06993fcf24411dfba8140403656340d.json

Response

{
 'id' : 'c06993fcf24411dfba8140403656340d',
 'slug' : 'micah_dnd_35e',
 'name' : 'Micah DnD 3.5e',
 'user' : {
  'id' : '5b6ef1e0f24411dfba8140403656340d',
  'username' : 'Micah',
  'profile_url' : 'http://www.obsidianportal.com/profile/Micah',
  'avatar_image_url' : 'http://cdn.obsidianportal.com/foo/bar/myface.jpg"
 },
 'game_system' : {
  'id' : 'd06993fcf24411dfba8140403656340d',
  'name' : 'DnD 3.5'
 },
 'state' : 'submitted',
 'html_template' : 'some html here...',
 'css' : 'some CSS rules here...',
 'javascript' : 'some javascript here...',
 'html_template_submitted' : 'Unapproved updated html here...',
 'css_submitted' : 'Unapproved CSS here...',
 'javascript_submitted' : 'Unapproved Javascript here...'
}

Update

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

  • id - identifier - The ID of the DST to update.

Optional Parameters: None
Response Code: 200
Response Body: A single DST.

Example

Request

Request Body

{
 'dynamic_sheet_template' : {
  'html_template_submitted' : 'Different unapproved HTML here...',
  'css_submitted' : 'Different unapproved CSS here...',
  'javascript_submitted' : 'Different unapproved Javascript here...'
 }
}

Response

{
 'id' : 'c06993fcf24411dfba8140403656340d',
 'slug' : 'micah_dnd_35e',
 'name' : 'Micah DnD 3.5e',
 'user' : {
  'id' : '5b6ef1e0f24411dfba8140403656340d',
  'username' : 'Micah',
  'profile_url' : 'http://www.obsidianportal.com/profile/Micah',
  'avatar_image_url' : 'http://cdn.obsidianportal.com/foo/bar/myface.jpg"
 },
 'game_system' : {
  'id' : 'd06993fcf24411dfba8140403656340d',
  'name' : 'DnD 3.5'
 },
 'state' : 'submitted',
 'html_template' : 'some html here...',
 'css' : 'some CSS rules here...',
 'javascript' : 'some javascript here...',
 'html_template_submitted' : 'Different unapproved HTML here...',
 'css_submitted' : 'Different unapproved CSS here...',
 'javascript_submitted' : 'Different unapproved Javascript here...'
}

Submit

URL: http://api.obsidianportal.com/v1/dynamic_sheet_templates/id/submit.format
HTTP Verb: PUT
Requires Authentication: Yes
Required Parameters:

  • id - identifier - The ID of the DST to submit.

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

Example

Request

http://api.obsidianportal.com/v1/dynamic_sheet_templates/c06993fcf24411dfba8140403656340d/submit.json

Response