Difference between revisions of "API:EventForms:Contact:Create"
(Created page with "== API » Contact Submit Event Form == '''URL:''' <nowiki>https://app.callproof.com/api/contact/event_form/create/</nowiki> '''Method:''' POST '''Required Fields:''...") |
Ashley DeBon (talk | contribs) |
||
| Line 1: | Line 1: | ||
| − | == [[API]] » Contact | + | == [[API]] » Create Contact Event Form == |
| − | + | === API Name === | |
| + | Create Contact Event Form | ||
| − | + | === Base URL === | |
| + | https://app.callproof.com | ||
| − | + | === Endpoint === | |
| + | /api/contact/event_form/create/ | ||
| − | + | === Purpose === | |
| − | + | Creates a new submitted event form record for a contact. This is used to save a completed event form, including custom field answers, optional file values, and optional location coordinates. | |
| − | |||
| − | |||
| − | + | === HTTP Method === | |
| − | + | POST | |
| − | |||
| − | |||
| − | |||
| − | + | === Headers === | |
| + | {| class="wikitable" | ||
| + | ! Header !! Required !! Description | ||
| + | |- | ||
| + | | Content-Type || Yes || Must be <code>application/json</code>. | ||
| + | |} | ||
| − | * ''' | + | === Security === |
| − | * '''''errors''''' | + | * '''Yes''' – Requires a valid API key and secret with permission to create event forms. |
| − | + | ||
| + | === Parameters === | ||
| + | |||
| + | ==== Query Parameters ==== | ||
| + | None. | ||
| + | |||
| + | ==== Path Parameters ==== | ||
| + | None. | ||
| + | |||
| + | ==== Request Body ==== | ||
| + | {| class="wikitable" | ||
| + | ! Field !! Type !! Required !! Description | ||
| + | |- | ||
| + | | api_key || object || Yes || API authentication object. | ||
| + | |- | ||
| + | | api_key.key || string || Yes || Public API key assigned to your CallProof account. | ||
| + | |- | ||
| + | | api_key.secret || string || Yes || Private API secret paired with the API key. | ||
| + | |- | ||
| + | | event_form_data || object || Yes || Event form submission data. | ||
| + | |- | ||
| + | | event_form_data.contact_id || integer || Yes || Unique identifier of the contact receiving the event form submission. Must belong to your company. | ||
| + | |- | ||
| + | | event_form_data.event_form_id || integer || Yes || Unique identifier of the event form being submitted. Must belong to your company. | ||
| + | |- | ||
| + | | event_form_data.latitude || string or number || No || Latitude where the event form was submitted. | ||
| + | |- | ||
| + | | event_form_data.longitude || string or number || No || Longitude where the event form was submitted. | ||
| + | |- | ||
| + | | event_form_data.custom_fields || array || No || List of custom field values to save. | ||
| + | |- | ||
| + | | event_form_data.custom_fields[].id || integer || Yes, when included || Custom field identifier. | ||
| + | |- | ||
| + | | event_form_data.custom_fields[].value || string || No || Value to save for the custom field. If omitted, an empty value is used. | ||
| + | |- | ||
| + | | event_form_data.files || array || No || List of file values to save for file/image custom fields. | ||
| + | |- | ||
| + | | event_form_data.files[].id || integer || Yes, when included || Custom field identifier for the file value. | ||
| + | |- | ||
| + | | event_form_data.files[].value || string || Yes, when included || Base64-encoded file content. | ||
| + | |- | ||
| + | | event_form_data.files[].content_type || string || Yes, when included || MIME type of the uploaded file, such as <code>image/jpeg</code> or <code>application/pdf</code>. | ||
| + | |- | ||
| + | | event_form_data.files[].name || string || Yes, when included || File name to store with the uploaded value. | ||
| + | |} | ||
| + | |||
| + | === cURL Example === | ||
| + | <pre> | ||
| + | curl -X POST "https://app.callproof.com/api/contact/event_form/create/" \ | ||
| + | -H "Content-Type: application/json" \ | ||
| + | -d '{ | ||
| + | "api_key": { | ||
| + | "key": "YOUR_API_KEY", | ||
| + | "secret": "YOUR_API_SECRET" | ||
| + | }, | ||
| + | "event_form_data": { | ||
| + | "contact_id": 789, | ||
| + | "event_form_id": 15, | ||
| + | "latitude": "35.1495", | ||
| + | "longitude": "-90.0490", | ||
| + | "custom_fields": [ | ||
| + | { | ||
| + | "id": 201, | ||
| + | "value": "Site visit completed" | ||
| + | }, | ||
| + | { | ||
| + | "id": 202, | ||
| + | "value": "1" | ||
| + | } | ||
| + | ], | ||
| + | "files": [ | ||
| + | { | ||
| + | "id": 301, | ||
| + | "name": "photo.jpg", | ||
| + | "content_type": "image/jpeg", | ||
| + | "value": "BASE64_ENCODED_FILE_CONTENT" | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | }' | ||
| + | </pre> | ||
| + | |||
| + | === Success (200) === | ||
| + | Returns the newly created contact event form submission record. | ||
| + | |||
| + | {| class="wikitable" | ||
| + | ! Field !! Type !! Description | ||
| + | |- | ||
| + | | results || object || Created event form submission record. | ||
| + | |- | ||
| + | | results.contact_event_form_id || integer || Unique identifier for the submitted event form record. | ||
| + | |- | ||
| + | | results.rep || object || Sales representative associated with the API key that created the submission. | ||
| + | |- | ||
| + | | results.rep.id || integer || Rep profile identifier. | ||
| + | |- | ||
| + | | results.rep.email || string || Rep email address. | ||
| + | |- | ||
| + | | results.rep.user_id || integer || Associated user account identifier. | ||
| + | |- | ||
| + | | results.rep.name || string || Rep display name. | ||
| + | |- | ||
| + | | results.rep.title || string || Rep job title. | ||
| + | |- | ||
| + | | results.rep.updated || string || Date and time the rep profile was last updated. | ||
| + | |- | ||
| + | | results.contact_id || integer || Associated contact identifier. | ||
| + | |- | ||
| + | | results.contact_name || string || Contact display name. | ||
| + | |- | ||
| + | | results.contact_full_addres || string || Full address of the contact. | ||
| + | |- | ||
| + | | results.contact_company_name || string || Company name associated with the contact. | ||
| + | |- | ||
| + | | results.event_form_id || integer || Identifier of the event form definition used. | ||
| + | |- | ||
| + | | results.event_form_name || string || Name of the event form definition used. | ||
| + | |- | ||
| + | | results.completed || string || <code>1</code> if the submission is completed; otherwise <code>0</code>. | ||
| + | |- | ||
| + | | results.created || string || Date and time the submission was created in <code>YYYY-MM-DD HH:MM:SS</code> format. | ||
| + | |- | ||
| + | | errors || array || Empty list when the request succeeds. | ||
| + | |- | ||
| + | | code || integer || HTTP-style status value; <code>200</code> on success. | ||
| + | |} | ||
| + | |||
| + | Example response: | ||
| + | <pre> | ||
| + | { | ||
| + | "results": { | ||
| + | "contact_event_form_id": 8801, | ||
| + | "rep": { | ||
| + | "id": 123, | ||
| + | "email": "rep@example.com", | ||
| + | "user_id": 456, | ||
| + | "name": "Jane Smith", | ||
| + | "title": "Account Executive", | ||
| + | "updated": "2024-06-01 10:00:00" | ||
| + | }, | ||
| + | "contact_id": 789, | ||
| + | "contact_name": "John Doe", | ||
| + | "contact_full_addres": "123 Main St, Austin, TX 78701", | ||
| + | "contact_company_name": "Acme Corp", | ||
| + | "event_form_id": 15, | ||
| + | "event_form_name": "Site Visit Form", | ||
| + | "completed": "0", | ||
| + | "created": "2024-06-15 14:30:00" | ||
| + | }, | ||
| + | "errors": [], | ||
| + | "code": 200 | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | === Notes === | ||
| + | * Authentication for this POST endpoint is sent in the JSON request body using <code>api_key.key</code> and <code>api_key.secret</code>. | ||
| + | * <code>contact_id</code> and <code>event_form_id</code> are required. | ||
| + | * Custom field values should be submitted using the custom field IDs returned by <code>/api/event_form/get/</code>. | ||
| + | * File values must include the custom field ID, base64-encoded file content, MIME type, and file name. | ||
| + | * Latitude and longitude are optional. Non-coordinate characters are removed before saving. | ||
| + | * Creating an event form submission updates the contact’s last-contacted date. | ||
| + | * Creating an event form submission may trigger configured event form emails, points, activity history, and configured external callbacks. | ||
| + | * Use <code>/api/contact/event_form/details/get/</code> after creation to retrieve field-level values for the submitted form. | ||
| + | * Not specified in Swagger. | ||
| + | |||
| + | === Error Responses === | ||
| + | {| class="wikitable" | ||
| + | ! Status Code !! Meaning | ||
| + | |- | ||
| + | | 400 || Bad Request – The JSON body is invalid, <code>event_form_data</code> is missing, the contact is invalid, or the event form ID is invalid. | ||
| + | |- | ||
| + | | 401 || Unauthorized – The API key and/or secret is missing, invalid, inactive, associated with a disabled account, or lacks permission to create event forms. | ||
| + | |- | ||
| + | | 405 || Method Not Allowed – A method other than POST was used. | ||
| + | |- | ||
| + | | 500 || Internal Server Error – An unexpected server problem occurred. Not specified in Swagger. | ||
| + | |} | ||
| + | |||
| + | '''400 response body examples:''' | ||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": ["Invalid json data"], | ||
| + | "code": 400 | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": ["Invalid 'contact' field"], | ||
| + | "code": 400 | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": ["Invalid 'event_form_id' field"], | ||
| + | "code": 400 | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | '''401 response body example:''' | ||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": ["Invalid API Key"], | ||
| + | "code": 401 | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | '''405 response body example:''' | ||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": ["Method not allowed"], | ||
| + | "code": 405 | ||
| + | } | ||
| + | </pre> | ||
Latest revision as of 14:55, 17 July 2026
Contents
API » Create Contact Event Form
API Name
Create Contact Event Form
Base URL
Endpoint
/api/contact/event_form/create/
Purpose
Creates a new submitted event form record for a contact. This is used to save a completed event form, including custom field answers, optional file values, and optional location coordinates.
HTTP Method
POST
Headers
| Header | Required | Description |
|---|---|---|
| Content-Type | Yes | Must be application/json.
|
Security
- Yes – Requires a valid API key and secret with permission to create event forms.
Parameters
Query Parameters
None.
Path Parameters
None.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | object | Yes | API authentication object. |
| api_key.key | string | Yes | Public API key assigned to your CallProof account. |
| api_key.secret | string | Yes | Private API secret paired with the API key. |
| event_form_data | object | Yes | Event form submission data. |
| event_form_data.contact_id | integer | Yes | Unique identifier of the contact receiving the event form submission. Must belong to your company. |
| event_form_data.event_form_id | integer | Yes | Unique identifier of the event form being submitted. Must belong to your company. |
| event_form_data.latitude | string or number | No | Latitude where the event form was submitted. |
| event_form_data.longitude | string or number | No | Longitude where the event form was submitted. |
| event_form_data.custom_fields | array | No | List of custom field values to save. |
| event_form_data.custom_fields[].id | integer | Yes, when included | Custom field identifier. |
| event_form_data.custom_fields[].value | string | No | Value to save for the custom field. If omitted, an empty value is used. |
| event_form_data.files | array | No | List of file values to save for file/image custom fields. |
| event_form_data.files[].id | integer | Yes, when included | Custom field identifier for the file value. |
| event_form_data.files[].value | string | Yes, when included | Base64-encoded file content. |
| event_form_data.files[].content_type | string | Yes, when included | MIME type of the uploaded file, such as image/jpeg or application/pdf.
|
| event_form_data.files[].name | string | Yes, when included | File name to store with the uploaded value. |
cURL Example
curl -X POST "https://app.callproof.com/api/contact/event_form/create/" \
-H "Content-Type: application/json" \
-d '{
"api_key": {
"key": "YOUR_API_KEY",
"secret": "YOUR_API_SECRET"
},
"event_form_data": {
"contact_id": 789,
"event_form_id": 15,
"latitude": "35.1495",
"longitude": "-90.0490",
"custom_fields": [
{
"id": 201,
"value": "Site visit completed"
},
{
"id": 202,
"value": "1"
}
],
"files": [
{
"id": 301,
"name": "photo.jpg",
"content_type": "image/jpeg",
"value": "BASE64_ENCODED_FILE_CONTENT"
}
]
}
}'
Success (200)
Returns the newly created contact event form submission record.
| Field | Type | Description |
|---|---|---|
| results | object | Created event form submission record. |
| results.contact_event_form_id | integer | Unique identifier for the submitted event form record. |
| results.rep | object | Sales representative associated with the API key that created the submission. |
| results.rep.id | integer | Rep profile identifier. |
| results.rep.email | string | Rep email address. |
| results.rep.user_id | integer | Associated user account identifier. |
| results.rep.name | string | Rep display name. |
| results.rep.title | string | Rep job title. |
| results.rep.updated | string | Date and time the rep profile was last updated. |
| results.contact_id | integer | Associated contact identifier. |
| results.contact_name | string | Contact display name. |
| results.contact_full_addres | string | Full address of the contact. |
| results.contact_company_name | string | Company name associated with the contact. |
| results.event_form_id | integer | Identifier of the event form definition used. |
| results.event_form_name | string | Name of the event form definition used. |
| results.completed | string | 1 if the submission is completed; otherwise 0.
|
| results.created | string | Date and time the submission was created in YYYY-MM-DD HH:MM:SS format.
|
| errors | array | Empty list when the request succeeds. |
| code | integer | HTTP-style status value; 200 on success.
|
Example response:
{
"results": {
"contact_event_form_id": 8801,
"rep": {
"id": 123,
"email": "rep@example.com",
"user_id": 456,
"name": "Jane Smith",
"title": "Account Executive",
"updated": "2024-06-01 10:00:00"
},
"contact_id": 789,
"contact_name": "John Doe",
"contact_full_addres": "123 Main St, Austin, TX 78701",
"contact_company_name": "Acme Corp",
"event_form_id": 15,
"event_form_name": "Site Visit Form",
"completed": "0",
"created": "2024-06-15 14:30:00"
},
"errors": [],
"code": 200
}
Notes
- Authentication for this POST endpoint is sent in the JSON request body using
api_key.keyandapi_key.secret. contact_idandevent_form_idare required.- Custom field values should be submitted using the custom field IDs returned by
/api/event_form/get/. - File values must include the custom field ID, base64-encoded file content, MIME type, and file name.
- Latitude and longitude are optional. Non-coordinate characters are removed before saving.
- Creating an event form submission updates the contact’s last-contacted date.
- Creating an event form submission may trigger configured event form emails, points, activity history, and configured external callbacks.
- Use
/api/contact/event_form/details/get/after creation to retrieve field-level values for the submitted form. - Not specified in Swagger.
Error Responses
| Status Code | Meaning |
|---|---|
| 400 | Bad Request – The JSON body is invalid, event_form_data is missing, the contact is invalid, or the event form ID is invalid.
|
| 401 | Unauthorized – The API key and/or secret is missing, invalid, inactive, associated with a disabled account, or lacks permission to create event forms. |
| 405 | Method Not Allowed – A method other than POST was used. |
| 500 | Internal Server Error – An unexpected server problem occurred. Not specified in Swagger. |
400 response body examples:
{
"results": [],
"errors": ["Invalid json data"],
"code": 400
}
{
"results": [],
"errors": ["Invalid 'contact' field"],
"code": 400
}
{
"results": [],
"errors": ["Invalid 'event_form_id' field"],
"code": 400
}
401 response body example:
{
"results": [],
"errors": ["Invalid API Key"],
"code": 401
}
405 response body example:
{
"results": [],
"errors": ["Method not allowed"],
"code": 405
}