Managing user lookups

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsManaging user lookups
Line 1: Line 1:
 
You can use the API to manage user [[DreamFactory/Features/Lookups|lookups]].
 
You can use the API to manage user [[DreamFactory/Features/Lookups|lookups]].
  
To retrieve lookups for users you include the relationship 'user_lookup_by_user_id'.
+
To add a user lookup you update the user record and include the relationship 'user_lookup_by_user_id'.
 +
<br/><br/>
 +
<pre>
 +
PATCH /api/v2/system/user?related=user_lookup_by_user_id 
 +
</pre>
 +
<pre>
 +
{
 +
  "resource": [
 +
    {
 +
      "id": 2,
 +
      "user_lookup_by_user_id": [
 +
        {
 +
          "name": "favorite_food",
 +
          "value": "pizza",
 +
          "private": false,
 +
          "description": null
 +
        }
 +
      ]
 +
    }
 +
  ]
 +
}
 +
</pre>
 +
 
 +
To retrieve user lookups you include the relationship 'user_lookup_by_user_id'.
 
<br/><br/>
 
<br/><br/>
 
<pre>
 
<pre>

Revision as of 13:28, 20 September 2016

You can use the API to manage user lookups.

To add a user lookup you update the user record and include the relationship 'user_lookup_by_user_id'.

PATCH /api/v2/system/user?related=user_lookup_by_user_id  
{
  "resource": [
    {
      "id": 2,
      "user_lookup_by_user_id": [
        {
          "name": "favorite_food",
          "value": "pizza",
          "private": false,
          "description": null
        }
      ]
    }
  ]
}

To retrieve user lookups you include the relationship 'user_lookup_by_user_id'.

GET /api/v2/system/user?related=user_lookup_by_user_id  
{
  "resource": [
    {
      "id": 2,
      "name": "Test User",
      "username": null,
      "first_name": "Test",
      "last_name": "User",
      "last_login_date": null,
      "email": "[email protected]",
      "is_active": true,
      "phone": "[email protected]",
      "security_question": null,
      "confirm_code": null,
      "default_app_id": null,
      "oauth_provider": null,
      "created_date": "2016-09-16 16:39:54",
      "last_modified_date": "2016-09-16 16:39:54",
      "created_by_id": 1,
      "last_modified_by_id": 1,
      "user_lookup_by_user_id": [
        {
          "id": 1,
          "user_id": 2,
          "name": "favorite_food",
          "value": "pizza",
          "private": false,
          "description": null,
          "created_date": "2016-09-16 16:39:54",
          "last_modified_date": "2016-09-16 16:39:54",
          "created_by_id": null,
          "last_modified_by_id": null
        }
      ]
    }
  ]
}