Some MySpace API endpoints allow the caller to re-set the format and time zone for date-time data returned by APIs. This page explains:
These optional REST API endpoint parameters to change the format of the related API time and date response data. NOTE: dateFormat and timeZone must be used together.
Contents |
The date-time data that currently appears in JSON and XML responses to an API call is in this format:
For example: "5/11/2009 4:28:23 PM"
When the timeZone query string parameter is absent, MySpace uses a default value of timeZone=-8. Thus, the currently default time zone is United States Pacific Standard Time. This zone definition is based on the Greenwich Mean Time (GMT) standard (aka Zulu time), where the GMT zone = 0. For reference information about the 8601 time zone standards available for use, see the W3C Date and Time Formats documentation.
To set the time zone, append the timeZone parameter to the query string. For example, to use United States Central Standard Time when looking up a specific friend, the basic call is as the follows (note that both dateFormat and timeZone parameters must always be used together):
/v1/users/{userId}/friend/{friendId}?dateFormat=iso8601&timeZone=-6
To specify the dateFormat, append one of the four date and time options:
NOTE: dateFormat and timeZone should always be used together.
In this example, the call specifies dateTime and timeZone formats that follow the ISO 8601 spec and sets the timezone to 7. In the response, the exact date and time of a mood update made anywhere in the world is expressed in a format that allows accurate comparisons, is human readable, and provides a timeZone location reference.
dateFormat=iso8601&timeZone=7
http://api.myspace.com/v1/users/20599042/status?oauth_consumer_key=7121df9883d145b48a173d38205f1209&oauth_nonce=633776915979373750&oauth_signature=qhxT49Gx3fcQsOAm+wC5JX8IXhA=&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1242094798&oauth_version=1.0&status=This is a test post from my MySpaceID Sample App
{
"mood" : "(none)",
"moodId" : 0,
"moodImageUrl" : null,
"moodLastUpdated" : "2009-05-12T09:27:45",
"status" : "Off to two private parties now. Tummy feeling a little better",
"user" : {
"image" : "http://c4.ac-images.myspacecdn.com/images01/8/s_25584f6c3a1955df11b24bf146ea2dff.jpg",
"largeImage" : "http://c4.ac-images.myspacecdn.com/images01/8/l_25584f6c3a1955df11b24bf146ea2dff.jpg",
"name" : "Donny Mack (DM)",
"uri" : "http://api.myspace.com/v1/users/20599042",
"userId" : 20599042,
"userType" : "RegularUser",
"webUri" : "http://www.myspace.com/dotnetdon"
}