External Content Sources
Use this API to define and manage external content sources. A source refers to the origin of the content records. Examples: forum, issue tracker, learning management system. Because end users can filter help center search results by content source, use descriptive names to help them understand and navigate your content.
For more information on federated search, see Introduction and About Zendesk Federated Search in Zendesk help.
JSON format
Sources are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
created_at | string | false | false | ISO-8601 compliant date-time reflecting the time the event was created. If not set, the API sets the value when it receives the event |
id | string | true | false | Universally Unique Lexicographically Sortable Identifier. See https://github.com/ulid/spec |
name | string | false | true | The name of the source to be displayed in the help center |
updated_at | string | false | false | ISO-8601 compliant date-time reflecting the time the event was last updated |
List External Content Sources
GET /api/v2/guide/external_content/sources
Returns a list of the external content sources created for this account.
Allowed for
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
page | object | Query | false | Paginate query |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/guide/external_content/sources \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/guide/external_content/sources?page="
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/sources")
.newBuilder()
.addQueryParameter("page", "");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/guide/external_content/sources',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
params: {
'page': '',
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/guide/external_content/sources?page="
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/guide/external_content/sources")
uri.query = URI.encode_www_form("page": "")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"meta": {
"after_cursor": "MG",
"before_cursor": "MQ",
"has_more": true
},
"sources": [
{
"created_at": "2020-05-01T09:12:20Z",
"id": "01E77R4513SKX3AE8H20Q0KJ1K",
"name": "My Library",
"updated_at": "2020-05-26T09:11:30Z"
}
]
}
Show External Content Source
GET /api/v2/guide/external_content/sources/{id}
Gets the specified external source.
Allowed for
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
id | string | Path | true | A unique identifier for the source |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/guide/external_content/sources/{id} \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"source": {
"created_at": "2020-05-01T09:12:20Z",
"id": "01E77R4513SKX3AE8H20Q0KJ1K",
"name": "My Library",
"updated_at": "2020-05-26T09:11:30Z"
}
}
Create External Content Source
POST /api/v2/guide/external_content/sources
Creates an external content source.
Allowed for
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
page | object | Query | false | Paginate query |
Example body
{
"source": {
"name": "My Library"
}
}
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/guide/external_content/sources \
-d '{"source": { "name": "My Library" }}' \
-H "Content-Type: application/json" \
-u {email_address}/token:{api_token} -X POST
Go
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://support.zendesk.com/api/v2/guide/external_content/sources?page="
method := "POST"
payload := strings.NewReader(`{
"source": {
"name": "My Library"
}
}`)
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/sources")
.newBuilder()
.addQueryParameter("page", "");
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
{
\"source\": {
\"name\": \"My Library\"
}
}""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var data = JSON.stringify({
"source": {
"name": "My Library"
}
});
var config = {
method: 'POST',
url: 'https://support.zendesk.com/api/v2/guide/external_content/sources',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
params: {
'page': '',
},
data : data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
import json
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/guide/external_content/sources?page="
payload = json.loads("""{
"source": {
"name": "My Library"
}
}""")
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers,
json=payload
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/guide/external_content/sources")
uri.query = URI.encode_www_form("page": "")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
request.body = %q({
"source": {
"name": "My Library"
}
})
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"source": {
"created_at": "2020-05-01T09:12:20Z",
"id": "01E77R4513SKX3AE8H20Q0KJ1K",
"name": "My Library",
"updated_at": "2020-05-26T09:11:30Z"
}
}
Update External Content Source
PUT /api/v2/guide/external_content/sources/{id}
Updates the specified external content source with the request body.
Allowed for
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
id | string | Path | true | A unique identifier for the source |
Example body
{
"source": {
"name": "My Library"
}
}
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/guide/external_content/sources/{id} \
-d '{"source": { "name": "My Library" }}' \
-H "Content-Type: application/json" \
-v -u {email_address}/token:{api_token} -X PUT
Go
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP"
method := "PUT"
payload := strings.NewReader(`{
"source": {
"name": "My Library"
}
}`)
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
{
\"source\": {
\"name\": \"My Library\"
}
}""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var data = JSON.stringify({
"source": {
"name": "My Library"
}
});
var config = {
method: 'PUT',
url: 'https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
data : data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
import json
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP"
payload = json.loads("""{
"source": {
"name": "My Library"
}
}""")
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"PUT",
url,
auth=auth,
headers=headers,
json=payload
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP")
request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")
request.body = %q({
"source": {
"name": "My Library"
}
})
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"source": {
"created_at": "2020-05-01T09:12:20Z",
"id": "01E77R4513SKX3AE8H20Q0KJ1K",
"name": "My Library",
"updated_at": "2020-05-26T09:11:30Z"
}
}
Delete External Content Source.
DELETE /api/v2/guide/external_content/sources/{id}
Deletes an external content source. Will also delete any crawler or record associated with this source.
Allowed for
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
id | string | Path | true | A unique identifier for the source |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/guide/external_content/sources/{id} \
-v -u {email_address}/token:{api_token} -X DELETE
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP"
method := "DELETE"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("DELETE", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'DELETE',
url: 'https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"DELETE",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/guide/external_content/sources/01E7GZVZHBWYD50V00XDMYCMYP")
request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
204 No Content
// Status 204 No Content
null