How to edit a custom field using BoldSign API?

Editing a custom field in the BoldSign API allows you to update the properties of an existing custom field associated with your brand. To edit a custom field using the BoldSign API, you will need to provide the updated field details, including the field's customFieldId , brandId and the new values for the properties you want to change.

Users can execute partial updates to a custom field by specifying only the fields they intend to modify. The API will modify the provided fields, leaving the remaining unchanged. However, if you want to edit values under the form field section, e.g for updating the fieldType you can specify as: "formField": {"fieldType": "CheckBox",} since it is a nested property.

Below are examples of how to edit field name of the created custom form field:

Code snippet

curl -X POST \
  'https://api.boldsign.com/v1/customField/edit?customFieldId={customFieldId}' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your api key}' \
  -H 'Content-Type: application/json' \
  -d '{
    "fieldName": "PhoneNumber",
    "brandId": "{your brand Id}",
    "formField": {
      "fieldType": "TextBox",
      "width": 60,
      "height": 40,
      "isRequired": true,
      "validationType": "NumbersOnly"
    }
    }'

var apiClient = new ApiClient("https://api.boldsign.com", "API-KEY");

var customFieldClient = new CustomFieldClient(apiClient);

var updateCustomField = new UpdateCustomField()
{
    CustomFieldId = "{customFieldId}",
    FieldName = "MobileNumber",
    BrandId = "{your brandId}",
    formField: {
    fieldType: "TextBox",
        width: 60,
        height: 40,
        isRequired: true,
        validationType: "NumbersOnly"
    }
};

var response = await customFieldClient.EditAsync(updateCustomField);
Console.WriteLine(response);

import requests

url = "https://api.boldsign.com/v1/customField/edit?customFieldId={customField Id}"
headers = {
    "Accept": "application/json;odata.metadata=minimal;odata.streaming=true",
    "X-API-KEY": "{your api key}",
    "Content-Type": "application/json;odata.metadata=minimal;odata.streaming=true"
}
data = {
    "fieldName": "MobileNumber",
    "brandId": "{your brand id}",
     "formField": {
        "fieldType": "TextBox",
        "width": 60,
        "height": 40,
        "isRequired": True,
        "validationType": "NumbersOnly"
    }
}

response = requests.post(url, headers=headers, json=data)

print(response.status_code)
print(response.json())  # or response.text if the response is not in JSON format

const axios = require('axios');

const url = 'https://api.boldsign.com/v1/customField/edit?customFieldId={customFieldId}';
const headers = {
  'Accept': 'application/json;odata.metadata=minimal;odata.streaming=true',
  'X-API-KEY': '{your api key}',
  'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true'
};

const data = {
  "fieldName": "MobileNumber",
  "brandId": "{your brand id}",
  "formField": {
    "fieldType": "TextBox",
    "width": 60,
    "height": 40,
    "isRequired": true,
    "validationType": "NumbersOnly"
  }

};

axios.post(url, data, { headers })
  .then(response => {
    console.log('Status Code:', response.status);
    console.log('Response Data:', response.data);
  })
  .catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
  });
<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;

$client = new GuzzleHttp\Client([ 'verify' => false, ]);

$url = 'https://api.boldsign.com/v1/customField/edit?customFieldId={customFieldId}';
$headers = [
    'Accept' => 'application/json;odata.metadata=minimal;odata.streaming=true',
    'X-API-KEY' => '{your api key}',
    'Content-Type' => 'application/json;odata.metadata=minimal;odata.streaming=true'
];

$data = [
    "fieldName" => "MobileNumber",
    "brandId" => "{your brand Id}",
    "formField" => [
        "fieldType" => "TextBox",
        "width" => 60,
        "height" => 40,
        "isRequired" => true,
        "validationType" => "NumbersOnly"
    ]
];

try {
    $response = $client->request('POST', $url, [
        'headers' => $headers,
        'json' => $data
    ]);

    echo 'Status Code: ' . $response->getStatusCode() . "\n";
    echo 'Response Body: ' . $response->getBody() . "\n";
} catch (RequestException $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
    if ($e->hasResponse()) {
        echo 'Response Body: ' . $e->getResponse()->getBody() . "\n";
    }
}

In the provided code example, provide the custom field values that you want to edit such as , such as fieldName, fieldDescription, fieldOrder and formField update with the new values. Replace the CustomId and brandId with your own values. When the above codes are executed, the custom field will be updated with the provided details.