You can deliver your content to CBS Interactive using either a web interface, or programmatically using HTTP. If you are delivering a small amount of content and you don't want to write the code needed to deliver via HTTP, you should use the web interface. If you are delivering a large amount of content or updating your content regularly, it will be more efficient to deliver it via the HTTP interface.
Creating a content app
Before you can deliver your content, you must set up a content app. You only have to do this once. To set up a content app:
1. Log into the Development Center.
2. Under MY APPS on the Development Center home page, click Create New App. The ABOUT THIS APPLICATION page appears.
3. Select consists solely of content that will be uploaded in CSV or XML format. Additional form fields appear.
4. Fill in the remaining fields and click Save & Continue. The ADDITIONAL INFORMATION page appears.
5. Either, supply additional information about your app and click Save and Continue.
OR
Click Skip this step.
The Development Center home page is displayed. Your new app is listed under MY APPS.
Preparing your content for delivery to CBS Interactive
Whether you deliver your content via the web interface or programmatically via HTTP, you must prepare your content in the appropriate form. You must submit your content as either XML or CSV, depending on the required format for the content you are submitting. The exact format of the XML or CSV documents to submit are described below.
Your data must identify players, sports, positions, and stats categories using official CBS Interactive codes. The procedure for obtaining these codes is given below.
Preparing player outlooks data
The fields for player outlooks are as follows:
Field Name
Description
player_outlooks
The outlook data root node
player_outlooks/@sport
The CBS Interactive sports code for the sport covered by the outlooks
player_outlooks/@timestamp (optional)
The timestamp of the outlook record in UNIX timestamp format. If you omit the timestamp field, the upload date and time will be used as the timestamp.
player_outlooks/player_outlook
The outlook for the player, as plain ASCII text. Any links or other HTML codes will be stripped from the field on submission. Any non-ASCII characters will cause an exception and must be fixed before your submission is accepted. Newlines in the text will be retained. A warning will be issued if anything is stripped from the content, but the content record will be accepted, in its stripped form.
player_outlooks/player_outlook/@player_id
The CBS Interactive player ID for the player whose outlook is being given.
The timestamp of the player's update in UNIX timestamp format. If you omit the timestamp field, the upload date and time will be used as the timestamp.
player_updates/player_update/@status (optional)
The status of the update, as one of the following: hot, cold, normal. If you do not specify the status field, it will default to normal.
player_updates/player_update/headline
The news headline for a player, as plain ASCII text. Any HTML codes or non-ASCII characters will be stripped from the field on submission.
player_updates/player_update/news
The news for the player, as plain ASCII text. Any HTML codes or non-ASCII will be stripped from the field on submission.
player_updates/player_update/analysis (optional)
The analysis of the news for the player, as plain ASCII text. Any HTML codes or non-ASCII will be stripped from the field on submission. If anything is stripped from the content, a warning will be issued, but the submission will be accepted.
If submitting your updates using HTTP, you would format your content as an XML file, as in the following example:
Pujols set to run the bases
. . .
Projections
The fields for each projection record are as follows:
Field Name
Description
player_id
A CBS Interactive player ID.
sport
A CBS Interactive sport name.
timestamp (optional)
The timestamp of the update record in UNIX timestamp format. If you omit the timestamp field, the upload date and time will be used as the timestamp.
timeframe
The timeframe covered by the projections, as a year in the format YYYY. This must be the year in which the current season started.
period
The following periods are available for Football and Baseball:
season - projections for the entire season
weekX - projections for the week (where 'X' is the period number as an integer, ex. week6)
The following periods are available for Baseball only:
restofweek - remainder of the week
7d - Next 7 days
14d - Next 14 days
monthX - projections for the month (where 'X' is the month number as an integer, ex. month8)
restofseason - remainder of the season
YYYYMMDD - Single day
(stats categories)*
One field for each stats category for which you are providing a projection. The name of each field is a CBS Interactive stats category code. The value of each field is the value of that stat in the appropriate format for that stat. You do not have to specify a projection for every stats category.
If you've already uploaded projections for a player for a period and want to make an update, the only Stats Categories that will update are the ones included in your new upload -- all other Stats Categories will remain unchanged. So, if you want to zero out a stat, you will need to upload the stat with a value of zero.
*Note: You can not upload Projections for Stats Categories that are calculated. They will be calculated for you based on the projections you've uploaded for the component stats -- see the list of calculated stats categories in the tables below.
The format of a projections submission is a CSV file, as in the following example, where the first row contains the field names, as described above, and the following rows contain the values, one record per row.
Baseball Pitching Categories that are Calculated (you can not upload these categories):
Pitching Stat
Name
Formula
BAA
Batting Average Against
HA / ABA
BBd9
Walks per Nine
BBI * 9 / INN (Note: INN is calculated by OUTS / 3)
ERA
Earned Run Average
ER * 9 / INN (Note: INN is calculated by OUTS / 3)
GdAO
Ground Outs/Air Outs
GO / AO
HIP
Hits per Inning
HA / INN (Note: INN is calculated by OUTS / 3)
Hd9
Hits per Nine
HA * 9 / INN (Note: INN is calculated by OUTS / 3)
INN
Innings
OUTS / 3
K-BB
Strikeouts Minus Walks
K - BBI
Kd9
Strikeouts per Nine
K * 9 / INN (Note: INN is calculated by OUTS / 3)
MERA
Modified ERA
800 * (4.5 - ERA) (Note: ERA is calculated by ER * 9 / INN and INN is calculated by OUTS / 3)
NW
Net Wins
2 * W - L
OBA
On Base Pct Against
(HA + BBI + HB) / PA
Rd9
Men on Base/ 9 Innings
(HA + BBI + HB) * 9 / INN (Note: INN is calculated by OUTS / 3)
W-L
Wins Minus Losses
W - L
WHIP
Walks + Hits / Inning
(BBI + HA) / INN (Note: INN is calculated by OUTS / 3)
WPCT
Winning Pct
W / (W + L)
Baseball Batting Categories that are Calculated (you can not upload these categories):
Batting Stat
Name
Formula
BA
Batting Average
H / AB
BP
Bases Produced
TB + SB
BPA
Plate Appearances (Batter)
AB + BB + HP + CI + SH + SF
COM
Combo
BB + SB - KO
DT
Doubles Plus Triples
2B + 3B
FPCT
Fielding Pct
(PO + AST) / FC
OBP
On Base Pct
(H + BB + HP) / (AB + BB + HP + SF)
OPS
On Base plus Slugging Pct
((H + BB + HP) / (AB + BB + HP + SF)) + (TB / AB)
PP
Production Pct
((H + BB + HP) / (AB + BB + HP + SF)) + (TB / AB)
RBI-HR
RBI Minus Home Runs
RBI - HR
RP
Runs Produced
R + RBI - HR
RPA
Runs Produced Average
(R + RBI - HR) / AB
RdAB
Runs per At Bat
R / AB
SB-CS
Stolen Bases - Caught Stealing
SB - CS
SBPCT
Stolen Base Pct
100 * SB / (SB + CS)
SDT
Singles + Doubles + Triples
1B + 2B + 3B
SLG
Slugging Pct
TB / AB
TPA
Total Pct Average
BA + ((H + BB + HP) / (AB + BB + HP + SF)) + (TB / AB)
XBH
Extra Base Hits
2B + 3B + HR
Football Defensive Categories that are Calculated (you can not upload these categories):
Defensive Stat
Name
Formula
DFTD
Defensive TD
IntTD + DFRTD
DTD
Total Defensive and Special Teams TD
IntTD + PRTD + KRTD + DFRTD + BFTD + BPTD + SFRTD
KRAvg
Kick Return Average (ST/DST)
KRYd / KR
PRAvg
Punt Return Average (ST/DST)
PRYd / PR
STTD
Special Teams TD
PRTD + KRTD + BFTD + BPTD + SFRTD
YDS
Yards Allowed
PaNetA + RuYdA
Football Offensive Categories that are Calculated (you can not upload these categories):
Offensive Stat
Name
Formula
CmpPct
Completion Percentage
PaCmp / PaAtt * 100
CmpPctMin
Completion Percentage, 10+ Pass Attempts
PaCmp / PaAtt * 100
IFRTD
Individual Fumble Recovery TD
OFRTD + DFRTD + SFRTD
IKRTD
Individual Kick Return TD
KRTD
IKRYd
Individual Kick Return Yards
KRYd
IPRTD
Individual Punt Return TD
PRTD
IPRYd
Individual Punt Return Yards
PRYd
MFG
Missed Field Goal
FGA - FG
MXP
Missed Extra Point
XPAtt - XP
PaRuYd
Passing and Rushing Yards
PaYd + RuYd
ReAvg
Average per Reception
ReYd / Recpt
ReAvgMin
Average per Reception, 3+ Receptions
ReYd / Recpt
ReFDPct
Receiving FD Pct
ReFD / Recpt * 100
RuAvg
Rushing Average per Attempt
RuYd / RuAtt
RuAvgMin
Rushing Average, 5+ Rushes
RuYd / RuAtt
RuReYd
Rushing and Receiving Yards
RuYd + ReYd
TarPct
Target Percentage
Tar / PaAtt * 100
TotYd
Passing, Rushing & Receiving Yards
PaYd + RuYd + ReYd
Rankings (coming soon)
The ability to create Content Applications for Rankings will not be available for the launch of the Fantasy Platform, but will be coming soon.
OBTAINING CBS INTERACTVE ID CODES
To obtain the official CBS Interactive ID codes to identify players, sports, positions, and stats categories you must request the appropriate resources using the Fantasy Platform API. For more information on the Fantasy Platform API and the resources available from it, see the Fantasy Platform API documentation.
There is currently no HTML interface to the Fantasy Platform API. To get the codes you can either type the URL of the resource into a browser and copy or save the XML or JSON document it returns for the browser window, or you can call the API from your application code using a standard HTTP request method.
To access the Fantasy Platform API, you will need an access token. You must pass the access token to the Fantasy Platform API as a parameter to the URL. For example, to request the Positions resource for the sport of baseball, you would use the following URL:
The URLs for the Players, Sports, Positions, and Stats Categories are as follows. See the Fantasy Platform API documentation for details on how to call each of these URLs.
Resource
URL
Players
http://api.cbssports.com/fantasy/players/list
Sports
http://api.cbssports.com/fantasy/sports
Positions
http://api.cbssports.com/fantasy/positions
Stats Categories
http://api.cbssports.com/fantasy/stats
Keeping up to date
With the exception of the player data, you should not need to retrieve the ID codes more than once per season. Due to player trades and other changes in status, the Players resource may change at any time during the season. To ensure that you are working with the most up-to-date information, you should request a new copy of the Players resource before preparing your content to submit to CBS Interactive.
Delivering your content using the web interface
To deliver your content using the web interface:
1. Log on to the Developer Center.
2. Under MY APPS on the DEVELOPMENT CENTER HOME page, choose your content app (the app you created under Creating a content app above).
3. Click the Upload Content button near the top of the page (it's right above the About This App box).
4. Set the Content Type field to the type of your content.
5. Either, chose the file you want to upload in the Upload File field
OR
Cut and past the the file contents into the Content field.
6. Press Submit. Your content will be validated and any errors or warnings will be displayed.
Delivering your content using HTTP
To deliver your content using HTTP, create an application to submit your content using the HTTP POST method. The POST method is supported by most programming and scripting languages, either natively or through a library. You must use the content type multipart/form-data.
Your content should be POSTed to the appropriate URL from the following list. Note that the access token must be included as a URL parameter named access_token.
Param
Value
access_token
Your CBSSports access token (In the sample below, the value xyz123abc789 is used to represent your access token.)
type
The type of content you are submitting: updates, projectionss or outlooks
response_format
The format in which you want the system to respond: json or xml (Note that this is NOT the format in which you are submitting your data. You MUST submit your data in XML.)
data
Your content, in XML or CSV format, as appropriate for the type of content you are submitting.
validate_only
(optional) A Boolean value indicating whether to save the data or just to validate the data and not actually save it. 1 (only validate the content) or 0 (validate and save the content).
The data you submit will be validated by the server when received. If the content is not valid, an error response code will be returned, along with a message detailing the validation errors.
If you submit several player updates or outlooks in a single transmission, they will be validated separately and the valid entries will be accepted. You will receive an error response code along with a message detailing which entries failed validation and why.
If your content submission is received and validated correctly, the API will return an HTTP status code of 200 OK.
The response format conforms to the following structure
If validate_only parameter is true:
# number of records received
# number of records validated successfly
Text describing the warning
...
Text describing the exception
...
If validate_only parameter is false and extra saved_records node is added to the summary specifying how many records were saved.:
# records received# records validated
# records saved
...
A 200 response will always be returned with the exception of a 500 for missing parameters and a 404 response will be returned if your access_token refers to an invalid application.