Create new field
To create a new field, specify both title and field type.
Endpoint
Section titled “Endpoint”HTTP method: POST
https://api.sender.net/v2/fields
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
title | string required | Name of the new field |
type | string required | The value must be one of the following: “number”, “text”, or “datetime”. |
Request Examples
Section titled “Request Examples”const url = new URL("https://api.sender.net/v2/fields");
let headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",};
let bodyContent = { "title": "New text field", "type": "text"};
fetch(url, { method: "POST", headers, body: JSON.stringify(bodyContent)}).then(response => response.json()).then(data => console.log(data)).catch(error => console.error('Error:', error));$client = new \GuzzleHttp\Client();
$json = [ "title" => "New text field", "type" => "text"];
$response = $client->post( 'https://api.sender.net/v2/fields', [ 'headers' => [ 'Authorization' => 'Bearer [your-token]', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => $json ]);
$body = $response->getBody()->getContents();$data = json_decode($body, true);print_r($data);import requestsimport json
url = "https://api.sender.net/v2/fields"
headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",}
payload = { "title": "New text field", "type": "text"}
response = requests.request('POST', url, headers=headers, json=payload)
print(response.json())curl -X POST \"https://api.sender.net/v2/fields" \-H "Authorization: Bearer [your-token]" \-H "Content-Type: application/json" \-H "Accept: application/json" \-d '{"title":"New text field","type":"text"}'Response
Section titled “Response”{ "success": true, "message": "Field successfully created", "data": { "id": "epxZye", "title": "New text field", "account_id": "eEqqve", "user_id": "egp79a", "created": "2022-06-02 10:12:25", "modified": "2022-06-02 10:12:25", "type": "text", "show": 0, "field_name": "{$new_text_field}", "position": 0, "default": false }}