List Fields API Methods
Table of Contents:
Note: Notice that in each API call you must provide the List ID that you are working on, otherwise the default List ID will be used.
Methods Summary
GET /api/list_fields
Description
This method fetches a collection of list fields.
Request
list_id
Optional int - List ID
Response Example
GET URL: https://api.ongage.net/<list_id>/api/list_fields
{ "metadata": { "error": false, "total": 2 }, "payload": [ { "id": 1, "account_id": 1, "list_id": 10, "name": "email", "title": "Email", "type": "email", "format": "", "default": null, "mandatory": true, "position": 0, "created": 1436710261, "modified": 1436710261, "deleted": null, "is_sms": false }, { "id": 2, "account_id": 1, "list_id": 10, "name": "address", "title": "Address", "type": "string", "format": "", "default": null, "mandatory": false, "position": 1, "created": 1436710261, "modified": 1436710261, "deleted": null, "is_sms": false } ] }
POST /api/list_fields
Description
This method creates a new list field.
Request
list_id
Optional int - List ID
name
Required string - Field name
title
Required string - Human readable field title
type
Required date,/ email / numeric / string
format
Required for date fields string - Required for date fields, Date format
default
Optional - Default value for field
mandatory
Optional boolean - Default: False
position
Required int - Numeric position
Optional Date Formats
'dd/mm/yyyy' 'mm/dd/yyyy' 'yyyy/mm/dd' 'dd-mm-yyyy' 'mm-dd-yyyy' 'yyyy-mm-dd' 'dd/mm/yyyy hh24:mi' 'mm/dd/yyyy hh24:mi' 'yyyy/mm/dd hh24:mi' 'dd-mm-yyyy hh24:mi' 'mm-dd-yyyy hh24:mi' 'yyyy-mm-dd hh24:mi' 'dd/mm/yyyy hh24:mi:ss' 'mm/dd/yyyy hh24:mi:ss' 'yyyy/mm/dd hh24:mi:ss' 'dd-mm-yyyy hh24:mi:ss' 'mm-dd-yyyy hh24:mi:ss' 'yyyy-mm-dd hh24:mi:ss'
Example
POST URL: https://api.ongage.net/<list_id>/api/list_fields
{ "list_id": 1, "name": "birthday", "title": "Birthday", "type": "date", "format": "yyyy-mm-dd", "default": "", "mandatory": true, "position": 4 }
POST api/list_fields/all_lists
Description
This method creates list field in all lists.
This method can be used by admins only.
Request
list_id
Required string - must be set to "all"
name
Required string - Field name
title
Required string - Human readable field title
type
Required date,/ email / numeric / string
format
Required for date fields string - Required for date fields, Date format
default
Optional - Default value for field
mandatory
Optional boolean - Default: False
position
Required int - Numeric position
Optional Date Formats
'dd/mm/yyyy' 'mm/dd/yyyy' 'yyyy/mm/dd' 'dd-mm-yyyy' 'mm-dd-yyyy' 'yyyy-mm-dd' 'dd/mm/yyyy hh24:mi' 'mm/dd/yyyy hh24:mi' 'yyyy/mm/dd hh24:mi' 'dd-mm-yyyy hh24:mi' 'mm-dd-yyyy hh24:mi' 'yyyy-mm-dd hh24:mi' 'dd/mm/yyyy hh24:mi:ss' 'mm/dd/yyyy hh24:mi:ss' 'yyyy/mm/dd hh24:mi:ss' 'dd-mm-yyyy hh24:mi:ss' 'mm-dd-yyyy hh24:mi:ss' 'yyyy-mm-dd hh24:mi:ss'
Request Example
POST URL: https://api.ongage.net/<list_id>/api/list_fields/all_lists
{ "list_id": "all", "name": "birthday", "title": "Birthday", "type": "date", "format": "yyyy-mm-dd", "default": "", "mandatory": true, "position": 4 }
Response
Key | Description |
---|---|
status | Contact search status, 1 = Pending, 2 = Completed |
status_desc | Contact search status description (Pending / Completed) |
Response Example
{ "metadata":{ "error":false }, "payload":{ "success_list_fields":[ { "name":"birthday", "title":"Birthday", "type":"date", "format":"yyyy-mm-dd", "default":"1986-03-17", "mandatory":true, "position":5, "account_id":12345, "list_id":11112, "id":12345678, "created":1528116138, "modified":1528116138, "deleted":null } ], "failed_lists_errors":{ "11134": "You have reached the maximum number of fields per list (21)", "11156": "You have reached the maximum number of fields per list (21)" } } }
PUT /api/list_fields/<List Field ID>
Description
This method updates a list field.
Restrictions: It cannot update the main 'email' field and cannot change 'type'.
Request
name
Optional string - Field name
title
Optional string - Human readable field title
format
Optional string - Date fields only, Date format
default
Optional - Default value for field
mandatory
Optional boolean - Default: False
position
Required int - Numeric position
Optional Date Formats
'dd/mm/yyyy' 'mm/dd/yyyy' 'yyyy/mm/dd' 'dd-mm-yyyy' 'mm-dd-yyyy' 'yyyy-mm-dd' 'dd/mm/yyyy hh24:mi' 'mm/dd/yyyy hh24:mi' 'yyyy/mm/dd hh24:mi' 'dd-mm-yyyy hh24:mi' 'mm-dd-yyyy hh24:mi' 'yyyy-mm-dd hh24:mi' 'dd/mm/yyyy hh24:mi:ss' 'mm/dd/yyyy hh24:mi:ss' 'yyyy/mm/dd hh24:mi:ss' 'dd-mm-yyyy hh24:mi:ss' 'mm-dd-yyyy hh24:mi:ss' 'yyyy-mm-dd hh24:mi:ss'
DELETE /api/list_fields/<List Field ID>
Description
This method deletes a list field.