Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

friend

GET /friend

Browse friends of a specific user

Example URI

http://example.com/restful_api/friend

h3. Parameters

Parameter

Type

Require ?

Description

search[search]

string

no

Keyword for searching friends

user_id

string

no

Iser id

limit

number

no

Limit return results

view

string

no

Support some view mode: mutual, online

Response

{
  "status": "success",
  "data": [
    {
      "user_id": "13",
      "friend_id": "26",
      "friend_user_id": "13",
      "is_top_friend": "0",
      "user_name": "profile-13",
      "full_name": "Isabella Jolie"
    },
    {
      "user_id": "7",
      "friend_id": "12",
      "friend_user_id": "7",
      "is_top_friend": "0",
      "user_name": "profile-7",
      "full_name": "Vivian"
    },
    {
      "user_id": "14",
      "friend_id": "28",
      "friend_user_id": "14",
      "is_top_friend": "0",
      "user_name": "profile-14",
      "full_name": "William"
    }
  ],
  "messages": []
}

DELETE /friend

Remove a friend

Example URI

http://example.com/restful_api/friend?friend_user_id=14

h3. Parameters

Parameter

Type

Require ?

Description

friend_user_id

number

yes

Friend id

Response

{
  "status": "success",
  "data": [],
  "messages": [
    "Friend successfully deleted."
  ]
}

POST /friend/request

Post new friend request

Example URI

http://example.com/restful_api/friend/request

h3. Parameters

Parameter

Type

Require ?

Description

user_id

number

yes

User id that want to be friend with

Response

{
  "status": "success",
  "data": [],
  "messages": [
    "Friend request successfully sent."
  ]
}

DELETE /friend/request

Cancel a friend request

Example URI

http://example.com/restful_api/friend

h3. Parameters

Parameter

Type

Require ?

Description

user_id

number

yes

Friend id

Response

{
  "status": "success",
  "data": [],
  "messages": [
    "Friend request successfully deleted."
  ]
}

PUT /friend/request

Accept or deny a friend request

Example URI

http://example.com/restful_api/friend/request

h3. Parameters

Parameter

Type

Require ?

Description

user_id

number

yes

Friend id

action

string

yes

Available values: accept, deny

Response

{
  "status": "success",
  "data": [],
  "messages": [
    "Friend request successfully accepted."
  ]
}
  • No labels