Represents a Facebook user.
Get fields and edges on a User.
Type | Description |
---|---|
GET /v21.0/{person-id}/ HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{person-id}/',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/{person-id}/",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{person-id}/",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{person-id}/"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
curl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/{person-id}/
The public_profile
permission allows apps to read the following fields:
id
first_name
last_name
middle_name
name
name_format
picture
short_name
Campo | Descripción |
---|---|
id numeric string | The app user's App-Scoped User ID. This ID is unique to the app and cannot be used by other apps. |
about string | Returns no data as of April 4, 2018. |
age_range | The age segment for this person expressed as a minimum and maximum age. For example, more than 18, less than 21. |
birthday string | The person's birthday. This is a fixed format string, like |
education | Returns no data as of April 4, 2018. |
email string | The User's primary email address listed on their profile. This field will not be returned if no valid email address is available. |
favorite_athletes | Athletes the User likes. |
favorite_teams | Sports teams the User likes. |
first_name string | The person's first name |
gender string | The gender selected by this person, |
hometown | The person's hometown |
id_for_avatars numeric string | A profile based app scoped ID. It is used to query avatars |
inspirational_people | The person's inspirational people |
installed bool | Is the app making the request installed |
is_guest_user bool | if the current user is a guest user. should always return false. |
languages | Facebook Pages representing the languages this person knows |
last_name string | The person's last name |
link string | A link to the person's Timeline. The link will only resolve if the person clicking the link is logged into Facebook and is a friend of the person whose profile is being viewed. |
local_news_megaphone_dismiss_status bool | Display megaphone for local news bookmark Obsoleto |
local_news_subscription_status bool | Daily local news notification Obsoleto |
locale string | The person's locale BásicoObsoleto |
location | The person's current location as entered by them on their profile. This field requires the |
meeting_for list<string> | What the person is interested in meeting for |
middle_name string | The person's middle name |
name string | The person's full name |
name_format string | The person's name formatted to correctly handle Chinese, Japanese, or Korean ordering |
political string | Returns no data as of April 4, 2018. |
quotes string | The person's favorite quotes |
relationship_status string | Returns no data as of April 4, 2018. |
religion string | Returns no data as of April 4, 2018. |
timestamp | The time that the shared login needs to be upgraded to Business Manager by |
significant_other | The person's significant other |
sports | Sports played by the person |
supports_donate_button_in_live_video bool | Whether the user can add a Donate Button to their Live Videos |
third_party_id string | A string containing an anonymous, unique identifier for the User, for use with third-parties. Deprecated for versions 3.0+. Apps using older versions of the API can get this field until January 8, 2019. Apps installed by the User on or after May 1st, 2018, cannot get this field. Obsoleto |
timezone float (min: -24) (max: 24) | The person's current timezone offset from UTC BásicoObsoleto |
token_for_business string | A token that is the same across a business's apps. Access to this token requires that the person be logged into your app or have a role on your app. This token will change if the business owning the app changes |
updated_time datetime | Updated time Obsoleto |
verified bool | Indicates whether the account has been verified. This is distinct from the
Obsoleto |
video_upload_limits | Video upload limits |
website string | Returns no data as of April 4, 2018. |
Perímetro | Descripción |
---|---|
Edge<Page> | Pages the User has a role on. |
Edge<AdStudy> | Ad studies that this User's can view. |
Edge<Album> | The photo albums this person has created |
Edge<AppRequestFormerRecipient> | App requests |
Edge<AppRequest> | This person's pending requests from an app |
Edge<Application> | assigned_applications |
Edge<BusinessAssetGroup> | Business asset groups that are assign to this business scoped user |
Edge<Page> | Pages that are assigned to this business scoped user |
Edge<ProductCatalog> | Product catalogs that are assigned to this business scoped user |
Edge<BusinessUser> | Business users corresponding to the user |
Edge<Business> | Businesses associated with the user |
Edge<UnifiedThread> | Facebook Messenger conversation |
Edge<PageUserMessageThreadLabel> | custom_labels |
Edge<Post> | The posts and links published by this person or others on their profile |
Edge<UserIDForApp> | Businesses can claim ownership of multiple apps using Business Manager. This edge returns the list of IDs that this user has in any of those other apps |
Edge<UserIDForApp> | Businesses can claim ownership of multiple apps using Business Manager. This edge returns the list of IDs that this user has in any of those other apps |
Edge<UserIDForPage> | Businesses can claim ownership of apps and pages using Business Manager. This edge returns the list of IDs that this user has in any of the pages owned by this business |
Edge<Page> | All the Pages this person has liked |
Edge<LiveVideo> | Live videos from this person |
Edge<Page> | Music this person likes |
Edge<PaymentSubscription> | Payment subscriptions |
Edge<Permission> | The permissions that the person has granted this app |
Edge<Photo> | Photos the person is tagged in or has uploaded |
Edge<ProfilePictureSource> | The person's profile picture |
Edge<Canvas> | A list of rich media documents belonging to Pages that the user has advertiser permissions on |
Edge<Video> | Videos the person is tagged in or uploaded |
Error | Descripción |
---|---|
100 | Invalid parameter |
200 | Permissions error |
190 | Invalid OAuth 2.0 Access Token |
104 | Incorrect signature |
368 | The action attempted has been deemed abusive or is otherwise disallowed |
459 | The session is invalid because the user has been checkpointed |
613 | Calls to this api have exceeded the rate limit. |
80004 | There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting#ads-management. |
230 | Permissions disallow message to user |
483 | The session is invalid because the user is in consent app blocking |
/{user_id}
.Parámetro | Descripción |
---|---|
emoji_color_pref int64 | emoji color preference. |
firstname string | This person's first name |
lastname string | This person's last name |
local_news_megaphone_dismiss_status enum {YES, NO} | Dismisses local news megaphone |
local_news_subscription_status enum {STATUS_ON, STATUS_OFF} | Preference for setting local news notifications |
name string | Used for test accounts only. Name for this account |
password string | Used for test accounts only. Password for this account |
success
: bool, Error | Descripción |
---|---|
190 | Invalid OAuth 2.0 Access Token |
459 | The session is invalid because the user has been checkpointed |
368 | The action attempted has been deemed abusive or is otherwise disallowed |
200 | Permissions error |
100 | Invalid parameter |
240 | Desktop applications cannot call this function for other users |
102 | Session key invalid or no longer valid |
2500 | Error parsing graph query |
210 | User not visible |
/{custom_audience_id}/users
.POST /v21.0/<CUSTOM_AUDIENCE_ID>/users HTTP/1.1
Host: graph.facebook.com
payload=%7B%22schema%22%3A%5B%22EMAIL%22%2C%22LOOKALIKE_VALUE%22%5D%2C%22data%22%3A%5B%5B%229b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254%22%2C44.5%5D%2C%5B%228cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee%22%2C140%5D%2C%5B%224eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a%22%2C0%5D%2C%5B%2298df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56%22%2C0.9%5D%5D%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/<CUSTOM_AUDIENCE_ID>/users',
array (
'payload' => '{"schema":["EMAIL","LOOKALIKE_VALUE"],"data":[["9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254",44.5],["8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee",140],["4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a",0],["98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56",0.9]]}',
),
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/<CUSTOM_AUDIENCE_ID>/users",
"POST",
{
"payload": "{\"schema\":[\"EMAIL\",\"LOOKALIKE_VALUE\"],\"data\":[[\"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254\",44.5],[\"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee\",140],[\"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a\",0],[\"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56\",0.9]]}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("payload", "{\"schema\":[\"EMAIL\",\"LOOKALIKE_VALUE\"],\"data\":[[\"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254\",44.5],[\"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee\",140],[\"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a\",0],[\"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56\",0.9]]}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/<CUSTOM_AUDIENCE_ID>/users",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
NSDictionary *params = @{
@"payload": @"{\"schema\":[\"EMAIL\",\"LOOKALIKE_VALUE\"],\"data\":[[\"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254\",44.5],[\"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee\",140],[\"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a\",0],[\"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56\",0.9]]}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/<CUSTOM_AUDIENCE_ID>/users"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
curl -X POST \
-F 'payload={
"schema": [
"EMAIL",
"LOOKALIKE_VALUE"
],
"data": [
[
"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254",
44.5
],
[
"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee",
140
],
[
"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a",
0
],
[
"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56",
0.9
]
]
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/<CUSTOM_AUDIENCE_ID>/users
Parámetro | Descripción |
---|---|
payload Object | Payload representing users to add |
session Object | Information about the session. Sessions are used when you have a lot of users to upload. For example, if you have 1 million users to upload, you need to split them into at least 100 requests because each request can only take 10k users. Specify the session info so that you can track if the session has finished or not. |
audience_id
: numeric string, session_id
: numeric string, num_received
: int32, num_invalid_entries
: int32, invalid_entry_samples
: Map {Error | Descripción |
---|---|
100 | Invalid parameter |
200 | Permissions error |
2650 | Failed to update the custom audience |
190 | Invalid OAuth 2.0 Access Token |
105 | The number of parameters exceeded the maximum for this operation |
Delete a test user
/{user_id}
.success
: bool, Error | Descripción |
---|---|
2903 | Cannot delete this test account |
2904 | Cannot delete the OG Test User |
240 | Desktop applications cannot call this function for other users |
100 | Invalid parameter |
102 | Session key invalid or no longer valid |
190 | Invalid OAuth 2.0 Access Token |
200 | Permissions error |
/{page_id}/blocked
.Parámetro | Descripción |
---|---|
asid user/page ID | App Scoped User ID to unblock |
psid UID | Page Scoped User ID to unblock |
uid UID | Deprecated. Same as |
user UID | List of User or Page IDs to unblock. This or |
success
: bool, Error | Descripción |
---|---|
100 | Invalid parameter |
/act_{ad_account_id}/assigned_users
.Parámetro | Descripción |
---|---|
user UID | Business user id or system user id Obligatorio |
success
: bool, Error | Descripción |
---|---|
3919 | There was an unexpected technical issue. Please try again. |
100 | Invalid parameter |
368 | The action attempted has been deemed abusive or is otherwise disallowed |
/{custom_audience_id}/users
.Parámetro | Descripción |
---|---|
payload Object | Payload representing users to delete |
session Object | Information about the session. Sessions are used when you have a lot of users to upload. For example, if you have 1 million users to upload, you need to split them into at least 100 requests because each request can only take 10k users. Specify the session info so that you can track if the session has finished or not. |
audience_id
: numeric string, session_id
: numeric string, num_received
: int32, num_invalid_entries
: int32, invalid_entry_samples
: Map {Error | Descripción |
---|---|
80003 | There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting#custom-audience. |
100 | Invalid parameter |
200 | Permissions error |
190 | Invalid OAuth 2.0 Access Token |
2650 | Failed to update the custom audience |
105 | The number of parameters exceeded the maximum for this operation |