Server social API

Getting information about the user's profile

Call: server-server HTTP GET
Authorization: Request signature:

Request format:
GET, https://games.mail.ru/app/[GMRID]/user/profile?uid=[int uid]&sign=[md5 hash]

Main parameters:
GMRID: the application's ID, part of the PATH in the URL
<uid>: the user's ID
[sign]: the request's unique digital signature

Response format:

Successful:

{
    "status": "ok",
    "uid": "[int uid]",
    "nick": "[str nick]",
    "avatar": "[url avatar]",
    "birthyear": "[str birthyear]",
    "sex": "[str male or female]",
    "slug": "[str unique user identificator]"
}

Error:

{
    "status": "error",
    "errcode": "[int errcode]",
    "errmsg": "[string errmsg]"
}

 

Inviting one or more users to the game

Call: server-server HTTP POST
Authorization: Request signature:

Request format:
POST, https://games.mail.ru/app/[GMRID]/user/invite/friends uid=[int uid] slugs=[str comma separated list] sign=[md5 hash]

Main parameters:
GMRID: the application's ID, part of the PATH in the URL
<uid>: the user's ID
<slugs>: slug list from the profiles of invited users The divider is a comma with no spaces.
[sign]: the request's unique digital signature

Response format:

Successful:

{
    "status": "ok",
}

 

Posting an invitation to the game on friends' feeds https://games.mail.ru/community/feed/

Call: server-server HTTP POST
Authorization: Request signature:

Request format:
POST, https://games.mail.ru/app/[GMRID]/user/invite/all uid=[int uid] sign=[md5 hash]

Main parameters:
GMRID: the application's ID, part of the PATH in the URL
<uid>: the user's ID
[sign]: the request's unique digital signature

Response format:

Successful:

{
    "status": "ok",
}

 

Posting on friends' feeds https://games.mail.ru/community/feed/

Call: server-server HTTP POST
Authorization: Request signature:

Request format:
POST, https://games.mail.ru/app/[GMRID]/user/share uid=[int uid] title=[str title] img_url=[str url] sign=[md5 hash]

Main parameters:
GMRID: the application's ID, part of the PATH in the URL
<uid>: the user's ID
[title]: title
[img_url]: link to image
[sign]: the request's unique digital signature

Response format:

Successful:

{
    "status": "ok",
}

 

Signature calculation General case

Help calculating signatures is available from the signature calculator.  To calculate a signature:

1. Take the request's parameters:

  • <uid>: 596343600
  • <paramA>: 123
  • <paramB>: some_string

2. Sort the parameters by key

{
    "paramA": 123,
    "paramB": "some_string",
    "uid": "596343600"
}

3. Glue together the key and the value into the line

$str = "paramA=123paramB=some_stringuid=596343600"

4. Generate a signature

$sign = md5($str . $secret)

$secret: the game's unique key. The partner can find it in the developer's profile, on the game's web page, in the "System characteristics" section. The relevant field is titled "Secret for api.games.mail.ru."

5. Send the signature in the GET parameter sign