Andrew Fletcher published: 16 May 2022 3 minutes read
The user API, was originally created under the General Documenation area (see Query - user). I'm creating a new user API document under the API documentation area.
Calling a query
To call a user query the details are required:
- User uid;
- Authentication credentials
The query string is: {domain}/user/{uid}?_format=hal_json
See the notes on set up, for the staging and production URLs. Using the current staging URL in the set up screen, as example of the query string using the following criteria
Replacing the following variables:
- {domain} ~ stg.runningrival.com
- {uid} ~ 3
https://your-site.com/user/3?_format=hal_json
Example of the json output
{
"_links": {
"self": {
"href": "https://your-site.com/user/3?_format=hal_json"
},
"type": {
"href": "https://your-site.com/rest/type/user/user"
}
},
"uid": [
{
"value": "3"
}
],
"uuid": [
{
"value": "2b167e74-11a0-4097-9de4-d49c8338e7c9"
}
],
"langcode": [
{
"value": "en",
"lang": "en"
}
],
"preferred_langcode": [
{
"value": "en"
}
],
"preferred_admin_langcode": [
{
"value": "en"
}
],
"name": [
{
"value": "rest"
}
],
"mail": [
{
"value": "test@your-site.com"
}
],
"timezone": [
{
"value": "Australia/Melbourne"
}
],
"status": [
{
"value": "1"
}
],
"created": [
{
"value": "1467306433"
}
],
"changed": [
{
"value": "1476503227",
"lang": "en"
}
],
"access": [
{
"value": "1490331462"
}
],
"login": [
{
"value": "1477037554"
}
],
"init": [
{
"value": "test@your-site.com"
}
],
"roles": [
{
"target_id": "administrator"
}
],
"default_langcode": [
{
"value": "1",
"lang": "en"
}
],
"field_firstname": [
{
"value": "Bill"
}
],
"field_gender": [
{
"value": "male"
}
],
"field_lastname": [
{
"value": "Caravans"
}
],
"field_mobile": [
{
"value": "04121212"
}
]
}