League Story v2.0

Summary
League Story
Resource
League StoryA story created by a fantasy league member.
Change Log
January 15, 2013
HTTP Methods
GETRetrieve a league story by ID.
Exceptions
Following list of exceptions will be returned.
HTTP Methods
POSTCreate a new league story
Example
Retrieve Story by ID
XML field definitions
/league_storyThe container element for a league story.
/league_story/@idThe ID of the league story.
/league_story/synopsisA synopsis of the league story.
/league_story/story_bodyThe text of the league story.
/league_story/dateThe publication date of the league story in the format Sep.
/league_story/authorThe name of the author of the story.
/league_story/titleThe title of the story.

Resource

League Story

Description

A story created by a fantasy league member.  To request a particular story, you must supply the ID of the story.  You can obtain a story ID by requesting the League Headlines resource.  The story ID will be found in the /league_headlines/league_headline/@id field of the League Headlines resource.

Change Log

January 15, 2013

  • Changed param news_id to id
  • Added exception handling

HTTP Methods

GET

Retrieve a league story by ID.

URL

http://api.cbssports.com/fantasy/league/news/story?version=2.0

Parameters

response_format(optional) Specifies the format in which the requested resource should be returned.  Valid values are XML and JSON.  The default is XML.
idThe ID of the story to be returned.  You can get a list of league story IDs by requesting the League Headlines resource.  The ID is found in the /league_headlines/league_headline/@id field.

Exceptions

Following list of exceptions will be returned.

  • type: required_parameter, msg: Missing required param: id
  • type: invalid_id, msg: Can not find story with id <id>

HTTP Methods

POST

Create a new league story

URL

http://api.cbssports.com/fantasy/league/news/story?version=2.0

Parameters

response_format(optional) Specifies the format in which the requested resource should be returned.  Valid values are XML and JSON.  The default is XML.

POST Data

To be sent as payload=JSON

payload={ "headline": "Headline of the story", "body": "Body of the story", "photo": "http://www.link_to_image", "caption": "Caption of the image" }

where

  • body can contain fully formatted html or plain text
  • photo and caption are optional

Example

Retrieve Story by ID

Sample URL

http://api.cbssports.com/fantasy/league/news/story?version=2.0&id=1285594162

XML Response

<?xml version="1.0"?>
<result uriAlias="/league/news/story" uri="/league/news/story" statusCode="200" statusMessage="OK">
  <body>
    <league_story id="1285594162">
      <synopsis> Synopsis </synopsis>
      <story_body> Story Body </story_body>
      <date>Sep. 27, 2010</date>
      <author> Author name </author>
      <title> Story Title </title>
    </league_story>
  </body>
</result>

JSON Response

{
   "body" : {
      "league_story" : {
         "synopsis" : "Synopsis",
         "story_body" : "Story body",
         "date" : "Sep. 27, 2010",
         "author" : "Author name",
         "title" : "Story title",
         "id" : "1285594162"
      }
   },
   "uriAlias" : "/league/news/story",
   "statusMessage" : "OK",
   "uri" : "/league/news/story",
   "statusCode" : 200
}

XML field definitions

/league_story

The container element for a league story.

/league_story/@id

The ID of the league story.  This is the ID that was used to request the resource.

/league_story/synopsis

A synopsis of the league story.

/league_story/story_body

The text of the league story.

/league_story/date

The publication date of the league story in the format Sep.  29, 2011.

/league_story/author

The name of the author of the story.  If the author is no longer a member of the league, the value will be Author no longer in league.

/league_story/title

The title of the story.

The ID of the league news story associated with this headline.