User Identities
A user identity is something that can be used to identify an individual. Most likely, it's an email address, a Twitter handle, or a phone number. Zendesk Support supports a series of different such identities.
JSON format
User Identities are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
created_at | string | true | false | The time the identity was created |
deliverable_state | string | true | false | Email identity type only. Indicates if Zendesk sends notifications to the email address. SeeDeliverable state |
id | integer | true | false | 奥特曼atically assigned on creation |
primary | boolean | false | false | If the identity is the primary identity. *Writable only when creating, not when updating. Use theMake Identity Primaryendpoint instead |
type | string | true | true | The type of this identity. Allowed values are "email", "twitter", "facebook", "google", "phone_number", "agent_forwarding", "any_channel", "foreign", or "sdk". |
undeliverable_count | integer | true | false | The number of times a soft-bounce response was received at that address |
updated_at | string | true | false | The time the identity was updated |
url | string | true | false | The API url of this identity |
user_id | integer | true | true | The id of the user |
value | string | true | true | The identifier for this identity, such as an email address |
verified | boolean | false | false | If the identity has been verified |
If the identity is of type "phone_number", the phone number must be a direct line, not a shared phone number. SeePhone Numberin the Users API.
Deliverable state
When a user has multiple email addresses, Zendesk will choose the best one to deliver email notifications. Thedeliverable_state
property helps to determine that identity. If the value is "deliverable", Zendesk will likely use that identity over other email addresses; in the same way, Zendesk will not choose an email address that will likely fail to receive an email.
Value | Description |
---|---|
deliverable | Email address marked as deliverable |
undeliverable | Email address marked as undeliverable |
ticket_sharing_partner | Email address used by a Ticket Sharing Partner integration between two Zendesk instances. Considered undeliverable to prevent email loops |
mailing_list | Email address used for mailing lists with multiple individual recipients. Considered undeliverable to prevent email loops |
reserved_example | Email address used for documentation and testing only. Includes @example.com, @example.net, @example.org, and @example.edu. Considered undeliverable because it's a reserved example domain |
machine | Email address used by other providers to deliver machine-generated emails (like automatic responses, marketing campaigns). Considered undeliverable to prevent email loops |
mailer_daemon | Email address reserved for delivery notifications agents. Includes[email protected]and @mailer-daemon.domain.com. Considered undeliverable because it's a machine address |
mandatory | Email address marked as mandatory. Zendesk will prefer this address in some situations when the user switches identities |
Example
{
"created_at":"2011-07-20T22:55:29Z",
"deliverable_state":"deliverable",
"id":35436,
"primary":true,
"type":"email",
"updated_at":"2011-07-20T22:55:29Z",
"url":"https://company.zendesk.com/api/v2/users/135/identities/35436.json",
"user_id":135,
"value":"[email protected]",
"verified":true
}
List Identities
GET /api/v2/users/{user_id}/identities
GET /api/v2/end_users/{user_id}/identities
Returns a list of identities for the given user.
如果身份验证使用第一端点an agent. Use the second if authenticating as an end user. End users can only list email and phone number identities.
Pagination
- Cursor pagination (recommended)
- Offset pagination
SeePagination.
Returns a maximum of 100 records per page.
Allowed For
- Agents
- Verified end users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
Code Samples
旋度
Agents only
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities.json\
-v -u{email_address}:{password}
旋度
Verified end users only
旋度https://{subdomain}.zendesk.com/api/v2/end_users/{user_id}/identities.json\
-v -u{email_address}:{password}
旋度https://{subdomain}.zendesk.com/api/v2/end_users/{user_id}/identities.json\
-v -u{email_address}/token:{api_token}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities"
method:="GET"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities")
.newBuilder();
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("GET",null)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'GET',
url:'https://example.zendesk.com/api/v2/users/35436/identities',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities")
request=Net::HTTP::Get.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"identities":[
{
"created_at":"2011-07-20T22:55:29Z",
"id":35436,
"primary":true,
"type":"email",
"updated_at":"2011-07-20T22:55:29Z",
"user_id":135,
"value":"[email protected]",
"verified":true
},
{
"created_at":"2012-02-12T14:25:21Z",
"id":77136,
"primary":false,
"type":"twitter",
"updated_at":"2012-02-12T14:25:21Z",
"user_id":135,
"value":"didgeridooboy",
"verified":true
},
{
"created_at":"2012-02-12T14:25:21Z",
"id":88136,
"primary":true,
"type":"phone_number",
"updated_at":"2012-02-12T14:25:21Z",
"user_id":135,
"value":"+1 555-123-4567",
"verified":true
}
]
}
Show Identity
GET /api/v2/users/{user_id}/identities/{user_identity_id}
GET /api/v2/end_users/{user_id}/identities/{user_identity_id}
Shows the identity with the given id for a given user.
如果身份验证使用第一端点an agent. Use the second if authenticating as an end user. End users can only view email or phone number identity.
Allowed For
- Agents
- Verified end users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
user_identity_id | integer | Path | true | The ID of the user identity |
Code Samples
旋度
Agents only
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{user_identity_id}.json\
-v -u{email_address}:{password}
旋度
Verified end users only
旋度https://{subdomain}.zendesk.com/api/v2/end_users/{user_id}/identities/{user_identity_id}.json\
-v -u{email_address}:{password}
旋度https://{subdomain}.zendesk.com/api/v2/end_users/{user_id}/identities/{user_identity_id}.json\
-v -u{email_address}/token:{api_token}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities/77938"
method:="GET"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities/77938")
.newBuilder();
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("GET",null)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'GET',
url:'https://example.zendesk.com/api/v2/users/35436/identities/77938',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities/77938"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities/77938")
request=Net::HTTP::Get.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
“身份”:{
"created_at":"2012-02-12T14:25:21Z",
"id":77938,
"primary":false,
"type":"twitter",
"updated_at":"2012-02-12T14:25:21Z",
"user_id":13531,
"value":"cabanaboy",
"verified":false
}
}
Create Identity
POST /api/v2/users/{user_id}/identities
POST /api/v2/end_users/{user_id}/identities.json
Adds an identity to a user's profile. An agent can add an identity to any user profile.
Supported identity types:
Type | Example |
---|---|
{ "type" : "email", "value" : "[email protected]" } |
|
{ "type" : "twitter", "value" : "screen_name" } |
|
{ "type" : "facebook", "value" : "855769377321" } |
|
{ "type" : "google", "value" : "[email protected]" } |
|
agent_forwarding | { "type" : "agent_forwarding", "value" : "+1 555-123-4567" } |
phone_number | { "type" : "phone_number", "value" : "+1 555-123-4567" } |
To create an identity without sending out a verification email, include a"skip_verify_email": true
property.
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
Code Samples
旋度
Agents only
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities.json\
-H"Content-Type: application/json"-X POST\
-d'{"identity": {"type": "email", "value": "[email protected]"}}'-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities"
method:="POST"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("POST",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'POST',
url:'https://example.zendesk.com/api/v2/users/35436/identities',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"POST",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities")
request=Net::HTTP::Post.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
“身份”:{
"created_at":"2012-02-12T14:25:21Z",
"id":77938,
"primary":false,
"type":"twitter",
"updated_at":"2012-02-12T14:25:21Z",
"user_id":13531,
"value":"cabanaboy",
"verified":false
}
}
Update Identity
PUT /api/v2/users/{user_id}/identities/{user_identity_id}
This endpoint allows you to:
- Set the specified identity as verified (but you cannot unverify a verified identity)
- Update the
value
property of the specified identity
You can't change an identity'sprimary
attribute with this endpoint. You must use theMake Identity Primaryendpoint instead.
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
user_identity_id | integer | Path | true | The ID of the user identity |
Code Samples
旋度
To updateverified
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{user_identity_id}.json\
-H"Content-Type: application/json"-X PUT\
-d'{"identity": {"verified": true}}'-v -u{email_address}:{password}
旋度
To updatevalue
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{user_identity_id}.json\
-H"Content-Type: application/json"-X PUT\
-d'{"identity": {"value": "[email protected]"}}'-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities/77938"
method:="PUT"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities/77938")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("PUT",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'PUT',
url:'https://example.zendesk.com/api/v2/users/35436/identities/77938',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities/77938"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"PUT",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities/77938")
request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
“身份”:{
"created_at":"2011-07-20T22:55:29Z",
"deliverable_state":"deliverable",
"id":35436,
"primary":true,
"type":"email",
"updated_at":"2011-07-20T22:55:29Z",
"user_id":135,
"value":"[email protected]",
"verified":true
}
}
Make Identity Primary
PUT /api/v2/users/{user_id}/identities/{user_identity_id}/make_primary
PUT /api/v2/end_users/{user_id}/identities/{user_identity_id}/make_primary
Sets the specified identity as primary. To change other attributes, use theUpdate Identityendpoint. This is a collection-level operation and the correct behavior for an API client is to subsequently reload the entire collection.
The first endpoint is the preferred option if authenticating as an agent. If authenticating as an end user, you can only use the second endpoint. In addition, an end user can only make an email identity primary if the email is verified.
Allowed For
- Agents
- Verified end users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
user_identity_id | integer | Path | true | The ID of the user identity |
Code Samples
旋度
Agents only
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{user_identity_id}/ make_primary.json\
-X PUT -v -u{email_address}:{password}-d'{}'-H"Content-Type: application/json"
旋度
Verified end users only
旋度https://{subdomain}.zendesk.com/api/v2/end_users/{user_id}/identities/{user_identity_id}/ make_primary.json\
-X PUT -v -u{email_address}:{password}-d'{}'-H"Content-Type: application/json"
旋度https://{subdomain}.zendesk.com/api/v2/end_users/{user_id}/identities/{user_identity_id}/ make_primary.json\
-X PUT -v -u{email_address}/token:{api_token}-d'{}'-H"Content-Type: application/json"
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities/77938/make_primary"
method:="PUT"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities/77938/make_primary")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("PUT",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'PUT',
url:'https://example.zendesk.com/api/v2/users/35436/identities/77938/make_primary',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities/77938/make_primary"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"PUT",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities/77938/make_primary")
request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"identities":[
{
"created_at":"2011-07-20T22:55:29Z",
"id":35436,
"primary":true,
"type":"email",
"updated_at":"2011-07-20T22:55:29Z",
"user_id":135,
"value":"[email protected]",
"verified":true
},
{
"created_at":"2012-02-12T14:25:21Z",
"id":77136,
"primary":false,
"type":"twitter",
"updated_at":"2012-02-12T14:25:21Z",
"user_id":135,
"value":"didgeridooboy",
"verified":true
},
{
"created_at":"2012-02-12T14:25:21Z",
"id":88136,
"primary":true,
"type":"phone_number",
"updated_at":"2012-02-12T14:25:21Z",
"user_id":135,
"value":"+1 555-123-4567",
"verified":true
}
]
}
Verify Identity
PUT /api/v2/users/{user_id}/identities/{user_identity_id}/verify
Sets the specified identity as verified.
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
user_identity_id | integer | Path | true | The ID of the user identity |
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{user_identity_id}/verify.json\
-X PUT -v -u{email_address}:{password}-d'{}'-H"Content-Type: application/json"
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities/77938/verify"
method:="PUT"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities/77938/verify")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("PUT",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'PUT',
url:'https://example.zendesk.com/api/v2/users/35436/identities/77938/verify',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities/77938/verify"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"PUT",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities/77938/verify")
request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
“身份”:{
"created_at":"2012-02-12T14:25:21Z",
"id":77938,
"primary":false,
"type":"twitter",
"updated_at":"2012-02-12T14:25:21Z",
"user_id":13531,
"value":"cabanaboy",
"verified":false
}
}
Request User Verification
PUT /api/v2/users/{user_id}/identities/{user_identity_id}/request_verification
PUT /api/v2/end_users/{user_id}/identities/{user_identity_id}/request_verification
Sends the user a verification email with a link to verify ownership of the email address.
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
user_identity_id | integer | Path | true | The ID of the user identity |
Code Samples
旋度
Agents only
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{user_identity_id}/request_verification.json\
-X PUT -v -u{email_address}:{password}-d'{}'-H"Content-Type: application/json"
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities/77938/request_verification"
method:="PUT"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities/77938/request_verification")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("PUT",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'PUT',
url:'https://example.zendesk.com/api/v2/users/35436/identities/77938/request_verification',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities/77938/request_verification"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"PUT",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities/77938/request_verification")
request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
null
删除Identity
DELETE /api/v2/users/{user_id}/identities/{user_identity_id}
DELETE /api/v2/end_users/{user_id}/identities/{user_identity_id}
删除s the identity for a given user. In certain cases, a phone number associated with an identity is still visible on the user profile after the identity has been deleted via API. You can remove the phone number from the user profile by updating thephone
attribute of the user to an empty string. SeeUpdate User via APIfor details and examples.
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The id of the user |
user_identity_id | integer | Path | true | The ID of the user identity |
Code Samples
旋度
Agents only
旋度https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{user_identity_id}.json\
-X DELETE -v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/users/35436/identities/77938"
method:="DELETE"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/users/35436/identities/77938")
.newBuilder();
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("DELETE",null)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'DELETE',
url:'https://example.zendesk.com/api/v2/users/35436/identities/77938',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://example.zendesk.com/api/v2/users/35436/identities/77938"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"DELETE",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/users/35436/identities/77938")
request=Net::HTTP::删除.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
204 No Content
/ /状态204No Content
null