Andrew Fletcher published: 16 May 2022 1 minute read
The user parameters provides details about a specific user based on the following parameters:
- User uid;
The output of this query will return user profile data only of the fields containing data. An example of the data returned includes, but is not limited to the following:
- Name {name} - in the system this is their username;
- Created {created}
- Firstname {field_firstname}
- Lastname {field_lastname}
- Gender {field_gender}
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
- uid = 32
https://your-site.com/user/32?_format=hal_json
Example of the json output
{
"_links": {
"self": {
"href": "http://your-site.com/user/32?_format=hal_json"
},
"type": {
"href": "http://your-site.com/rest/type/user/user"
}
},
"uid": [
{
"value": "32"
}
],
"uuid": [
{
"value": "f000c9a3-82b2-4ef7-92bb-786f00863c66"
}
],
"langcode": [
{
"value": "en",
"lang": "en"
}
],
"name": [
{
"value": "malcom"
}
],
"created": [
{
"value": "1467304565"
}
],
"changed": [
{
"value": "1475776333",
"lang": "en"
}
],
"default_langcode": [
{
"value": "1",
"lang": "en"
}
],
"field_firstname": [
{
"value": "Ron"
}
],
"field_gender": [
{
"value": "male"
}
]
}