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

Version 1 Next »

GET /user

Get a list of available users. Users can also be browsed by keywords, gender, age, and other profile fields

Example URI

http://example.com/restful_api/user?page=1&limit=10

Parameters

ParameterTypeRequire ?Description
pagenumbernoPaging the result items
limitnumbernoLimit the result items
viewstringnoOptions: recommendrecent
search[gender]numbernoSpecify the gender of searching users (gender id)
search[from]numbernoSpecify the minimum age of searching users
search[to]numbernoSpecify the maximum age of searching users
search[country]stringnoSpecify the country of searching users (country code)
search[country_child_id]numbernoSpecify the state/province of searching users (state id/ province id)
search[zip]stringnoSpecify the zip code of searching users
search[city]stringnoSpecify the city of searching users
search[keyword]stringnoSearch for users that contains this keyword in their name
customarraynoSpecify custom fields of searching users

Response

{
  "status": "success",
  "data": [
    {
      "is_friend": null,
      "is_friend_request": null,
      "user_id": "1",
      "user_name": "admin",
      "full_name": "Admin",
      "user_image": "2016/12/07140d52d833bb6c304ee1f48bbe623f%s.png"
    },
    {
      "is_friend": "1",
      "is_friend_request": null,
      "user_id": "2",
      "user_name": "neil",
      "full_name": "Neil",
      "user_image": null
    }
  ],
  "messages": []
}

POST /user

Register a user account

Example URI

http://example.com/restful_api/user

Parameters

Input fields base on site settings

Response

 {
  "status": "success",
  "data": {
    "cover_photo_exists": null,
    "user_id": "7",
    "user_group_id": "2",
    "user_name": "profile-7",
    "full_name": "Vivian",
    "email": "vivian@example.com",
    "gender": "0",
    "birthday": null,
    "birthday_search": "0",
    "country_iso": null,
    "language_id": null,
    "time_zone": null,
    "user_image": null,
    "is_online": null,
    "title": "Registered User",
    "is_friend": false,
    "is_friend_of_friend": false,
    "is_friend_request": false,
    "relation_id": null,
    "relation_with_id": null,
    "relation_phrase": null
  },
  "messages": [
    "User successfully added."
  ]
}

GET /user/:id

Get information of a specific user by user id

Example URI

http://example.com/restful_api/user/1

Parameters

ParameterTypeRequire ?Description
idnumberyesUser id

Response

{
  "status": "success",
  "data": {
    "cover_photo_exists": "6",
    "user_id": "1",
    "user_group_id": "1",
    "user_name": "admin",
    "full_name": "Admin",
    "email": "robert@example.com",
    "gender": "3",
    "birthday": "05091988",
    "birthday_search": "579139200",
    "country_iso": "US",
    "language_id": "en",
    "time_zone": "z357",
    "user_image": "2016/12/07140d52d833bb6c304ee1f48bbe623f%s.png",
    "is_online": "1",
    "title": "Administrator",
    "is_friend": false,
    "is_friend_of_friend": false,
    "is_friend_request": false,
    "relation_id": "2",
    "relation_with_id": "0",
    "relation_phrase": "Single"
  },
  "messages": []
} 

PUT /user/:id

Update a specific user

Example URI

http://example.com/restful_api/user/1

Parameters

ParameterTypeRequire ?Description
idnumberyesUser Id
val[email]stringnoEmail address
val[user_name]stringnoUser name
val[full_name]stringnoFull name
val[language_id]stringnoLanguage id
val[time_zone]stringnoTimezone id
val[default_currency]stringnoDefault currency
val[city_location]stringnoCity location
val[country_iso]stringnoCountry iso
val[day]numbernoDay of birth
val[month]numbernoMonth of birth
val[year]numbernoYear of birth
val[gender]numbernoGender id
val[country_child_id]numbernoState id or province id
val[postal_code]stringnoPostal code
val[relation]numbernoRelation id
val[relation_with]numbernoId of user that have relation with this user
val[password]stringnoUpdate password
val[delete_image]numbernoDelete profile photo or not
imageimage filenoUpload profile photo

Response

 {
  "status": "success",
  "data": {
    "cover_photo_exists": null,
    "user_id": "7",
    "user_group_id": "2",
    "user_name": "profile-7",
    "full_name": "Vivian",
    "email": "vivian@phpfox.com",
    "gender": "0",
    "birthday": null,
    "birthday_search": "0",
    "country_iso": null,
    "language_id": null,
    "time_zone": null,
    "user_image": null,
    "is_online": null,
    "title": "Registered User",
    "is_friend": false,
    "is_friend_of_friend": false,
    "is_friend_request": false,
    "relation_id": null,
    "relation_with_id": null,
    "relation_phrase": null
  },
  "messages": [
    "User successfully added."
  ]
}

DELETE /user/:id

Delete a specific user

Example URI

http://example.com/restful_api/user/2

Parameters

ParameterTypeRequire ?Description
idnumberyesUser id

Response

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

GET /user/custom/:id

Get custom fields information of a specific user by user id

Example URI

http://example.com/restful_api/user/custom/1

Parameters

ParameterTypeRequire ?Description
idnumberyesUser id

Response

 {
  "status": "success",
  "data": [
    {
      "field_id": "2",
      "field_name": "job",
      "field_label": "Job",
      "var_type": "select",
      "value": "Back-end Developer",
      "custom_value": "1",
      "group_id": "2",
      "group_label": "Personal Information"
    },
    {
      "field_id": "3",
      "field_name": "hobbies_and_interest",
      "field_label": "hobbies and interests:",
      "var_type": "text",
      "value": "Reading books, traveling, cooking...",
      "custom_value": "",
      "group_id": "2",
      "group_label": "Personal Information"
    },
    {
      "field_id": "1",
      "field_name": "about_me",
      "field_label": "About Me",
      "var_type": "textarea",
      "value": "I'm a good guy :)",
      "custom_value": "",
      "group_id": "1",
      "group_label": "About Me"
    }
  ],
  "messages": []
}

PUT /user/custom/:id

Update custom fields values of a specific user

Example URI

http://example.com/restful_api/user/custom/1

Parameters

ParameterTypeRequire ?Description
idnumberyesUser Id
customarraynoCustom fields values

Response

 {
  "status": "success",
  "data": [
    {
      "field_id": "3",
      "field_name": "hobbies_and_interest",
      "field_label": "hobbies and interests:",
      "var_type": "text",
      "value": "Reading books, traveling, cooking...",
      "custom_value": "",
      "group_id": "2",
      "group_label": "Personal Information"
    },
    {
      "field_id": "2",
      "field_name": "job",
      "field_label": "Job",
      "var_type": "select",
      "value": "Back-end Developer",
      "custom_value": "1",
      "group_id": "2",
      "group_label": "Personal Information"
    },
    {
      "field_id": "1",
      "field_name": "about_me",
      "field_label": "About Me",
      "var_type": "textarea",
      "value": "I'm a good guy :)",
      "custom_value": "",
      "group_id": "1",
      "group_label": "About Me"
    }
  ],
  "messages": [
    "Custom fields successfully updated."
  ]
}
  • No labels