How to Retrieve Field Dependency Mappings Using BoldDesk API
BoldDesk allows you to retrieve field dependency mappings programmatically using the Developer API. This is useful when you need to access configured parent-child relationships between dependent ticket fields, such as Category and Sub-category values, for reporting, integrations, or custom applications. You can retrieve the “Field Dependency” data using our Developer API, which provides a flexible and efficient way to access field dependency records.
Why Use the Field Dependency API?
The Field Dependency API helps you:
- Retrieve field dependency configurations.
- Access Category and Sub-category mappings programmatically.
- Integrate dependency data with external systems.
- Automate reporting and synchronization processes.
Prerequisites
Before you begin, ensure that you have:
- A BoldDesk account with API access.
- A valid API key. Explore how to Generate and Manage API Keys in BoldDesk.
- The Field Dependency ID that you want to retrieve.
- Manage API keys Permission under Profile module.
- To authenticate API requests, you must include a valid API key in the
x-api-keyrequest header. - Field dependency mappings can only be retrieved through the Developer API.
Get Field Dependency Data
Use the following API endpoint to retrieve field dependency information:
Endpoint
GET /api/v1/field_dependencies/{fieldDependencyId}
Developer API Reference: Get Field Dependency – Developer API link
Sample Request
curl -X GET "https://{yourdomain}/api/v1/field_dependencies/1" \
-H "x-api-key: {yourapikey}"
Sample Code Snippets
C#
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var apiKey = "{yourapikey}";
var apiUrl = "https://{yourdomain}/api/v1/field_dependencies/1";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", apiKey);
var response = await client.GetAsync(apiUrl);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + content);
}
}
Java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiCall {
public static void main(String[] args) {
String apiKey = "{yourapikey}";
String apiUrl = "https://{yourdomain}/api/v1/field_dependencies/1";
try {
URL url = new URL(apiUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("x-api-key", apiKey);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
con.disconnect();
System.out.println("Response: " + content);
} catch (Exception e) {
e.printStackTrace();
}
}
}
- To retrieve Category and Sub-Category mappings, use the Get Field Dependency API, which returns the configured parent-child relationships between dependent field values.
- Direct Excel or CSV export of these mappings is not currently supported; the mapping data must be retrieved programmatically through the API endpoint:
GET /api/v1/field_dependencies/{fieldDependencyId}. - API access follows the permissions assigned to the agent’s role, so the API can only access resources and perform actions that the agent is authorized to use within BoldDesk.
Troubleshooting
Authentication failures (missing or invalid API key)
Request fails because the server rejects authentication.
Checks
- Confirm the request includes
x-api-key: {yourapikey}. - Confirm the API key is valid and active.
Permission-related access issues
The API call does not return the expected resource.
Checks
- Confirm the authenticated agent has the required role permissions.
- Confirm the agent has Manage API keys permission under the Profile module (required to use/manage keys).
Incorrect fieldDependencyId
The API response does not match the intended dependency mapping.
Checks
- Confirm the
fieldDependencyIdvalue matches the field dependency record you intend to retrieve. - Obtain the correct Field Dependency ID from the field dependency configuration or from other API responses that reference field dependencies.
Frequently Asked Questions
-
Can I export Category and Sub-category mappings directly to Excel or CSV?
No. Direct export of field dependency mappings to Excel or CSV is not currently supported. You must retrieve the mappings using the Get Field Dependency API and then export the data programmatically. -
How do I authenticate API requests?
Include your API key in thex-api-keyrequest header.x-api-key: {yourapikey} -
Where can I find the Field Dependency ID?
The Field Dependency ID can be obtained from your field dependency configuration or through other relevant API responses that reference field dependencies. -
Can I retrieve all dependency mappings using the API?
Yes. The API returns the configured field dependency details for the specified field dependency record, including its parent-child value mappings. -
Is API access required to retrieve Category and Sub-category relationships?
Yes. Field dependency mapping information can only be retrieved through the BoldDesk Developer API.