Difference between revisions of "API:Companies:Stats:HTML:Update"
Greg Donald (talk | contribs) |
Ashley DeBon (talk | contribs) |
||
| Line 1: | Line 1: | ||
| + | == [[API]] » Update Company Stats HTML == | ||
| + | |||
| + | == Update Company Stats HTML == | ||
| + | |||
| + | === Base URL === | ||
| + | https://app.callproof.com | ||
| + | |||
| + | === Endpoint === | ||
| + | /api/companies/stats/html/update/ | ||
| + | |||
| + | === Purpose === | ||
| + | Creates or updates custom HTML statistics content for your CallProof company. Use this endpoint to store or refresh company-wide statistics that are not associated with an individual sales representative. If company statistics already exist, they are updated; otherwise, a new record is created. | ||
| + | |||
| + | === HTTP Method === | ||
| + | POST | ||
| + | |||
| + | === Headers === | ||
| + | |||
| + | {| class="wikitable" | ||
| + | ! Header !! Required !! Description | ||
| + | |- | ||
| + | | Content-Type || Yes || Must be <code>application/json</code>. | ||
| + | |} | ||
| + | |||
| + | === Security === | ||
| + | |||
| + | * '''Yes''' – Requires a valid API key and secret with permission to update company statistics HTML. Authentication credentials are provided in the request body. | ||
| + | |||
| + | === Parameters === | ||
| + | |||
| + | ==== Path Parameters ==== | ||
| + | None. | ||
| + | |||
| + | ==== Query Parameters ==== | ||
| + | None. | ||
| + | |||
| + | ==== Request Body ==== | ||
| + | |||
| + | {| class="wikitable" | ||
| + | ! Parameter !! Type !! Required !! Description | ||
| + | |- | ||
| + | | api_key || object || Yes || Authentication credentials. | ||
| + | |- | ||
| + | | api_key.key || string || Yes || Public API key assigned to your CallProof account. | ||
| + | |- | ||
| + | | api_key.secret || string || Yes || Private API secret associated with the API key. | ||
| + | |- | ||
| + | | company || object || Yes || Company statistics information. | ||
| + | |- | ||
| + | | company.html || string || No || HTML content to store for the company statistics. Leading and trailing whitespace is removed. Maximum length is 4,096 characters. | ||
| + | |} | ||
| − | == | + | === cURL Example === |
| − | + | <pre> | |
| + | curl -X POST "https://app.callproof.com/api/companies/stats/html/update/" \ | ||
| + | -H "Content-Type: application/json" \ | ||
| + | -d '{ | ||
| + | "api_key": { | ||
| + | "key": "YOUR_API_KEY", | ||
| + | "secret": "YOUR_API_SECRET" | ||
| + | }, | ||
| + | "company": { | ||
| + | "html": "<div>Team calls today: 250</div>" | ||
| + | } | ||
| + | }' | ||
| + | </pre> | ||
| − | + | === Successful Response (200) === | |
| − | + | Returns the saved company-level HTML statistics. | |
| − | + | {| class="wikitable" | |
| − | + | ! Field !! Type !! Description | |
| − | + | |- | |
| + | | results || object || Updated company statistics record. | ||
| + | |- | ||
| + | | results.user_id || null || Always <code>null</code> because company statistics are not associated with an individual user. | ||
| + | |- | ||
| + | | results.user || string || Empty string for company-level statistics. | ||
| + | |- | ||
| + | | results.email || string || Empty string for company-level statistics. | ||
| + | |- | ||
| + | | results.html || string or null || Stored company HTML statistics. | ||
| + | |- | ||
| + | | errors || array || Empty when the request succeeds. | ||
| + | |- | ||
| + | | code || integer || HTTP-style status code (<code>200</code>). | ||
| + | |} | ||
| − | + | Example response: | |
| − | + | <pre> | |
| + | { | ||
| + | "results": { | ||
| + | "user_id": null, | ||
| + | "user": "", | ||
| + | "email": "", | ||
| + | "html": "<div>Team calls today: 250</div>" | ||
| + | }, | ||
| + | "errors": [], | ||
| + | "code": 200 | ||
| + | } | ||
| + | </pre> | ||
| − | + | === Error Responses === | |
| − | + | {| class="wikitable" | |
| − | + | ! Status Code !! Meaning | |
| − | + | |- | |
| + | | 401 || Unauthorized – The API key or secret is missing, invalid, inactive, associated with a disabled account, or does not have permission to update company statistics. | ||
| + | |- | ||
| + | | 405 || Method Not Allowed – A method other than POST was used. | ||
| + | |- | ||
| + | | 500 || Internal Server Error – An unexpected server error occurred. | ||
| + | |} | ||
| + | '''401 response example:''' | ||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": [ | ||
| + | "Invalid API Key" | ||
| + | ], | ||
| + | "code": 401 | ||
| + | } | ||
| + | </pre> | ||
| − | ''' | + | '''405 response example:''' |
<pre> | <pre> | ||
| − | + | { | |
| − | + | "results": [], | |
| − | + | "errors": [ | |
| − | + | "Method not allowed" | |
| − | + | ], | |
| − | + | "code": 405 | |
| − | + | } | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
</pre> | </pre> | ||
| + | |||
| + | === Notes === | ||
| + | |||
| + | * This endpoint creates a new company statistics record if one does not already exist; otherwise, it updates the existing record. | ||
| + | * Company statistics are stored independently of individual sales representatives, so the returned <code>user_id</code>, <code>user</code>, and <code>email</code> fields are empty. | ||
| + | * The HTML content supports up to <code>4,096</code> characters. | ||
| + | * If <code>company.html</code> is omitted or contains only whitespace, any existing HTML content may be cleared. | ||
| + | * Authentication credentials are supplied in the JSON request body rather than HTTP headers. | ||
| + | * This endpoint accepts only <code>POST</code> requests with a JSON payload. | ||
| + | * This endpoint does not perform field-level validation on the HTML content; therefore, it does not return a <code>400 Bad Request</code> response for missing or invalid HTML. | ||
Revision as of 08:09, 17 July 2026
Contents
API » Update Company Stats HTML
Update Company Stats HTML
Base URL
Endpoint
/api/companies/stats/html/update/
Purpose
Creates or updates custom HTML statistics content for your CallProof company. Use this endpoint to store or refresh company-wide statistics that are not associated with an individual sales representative. If company statistics already exist, they are updated; otherwise, a new record is created.
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 update company statistics HTML. Authentication credentials are provided in the request body.
Parameters
Path Parameters
None.
Query Parameters
None.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| api_key | object | Yes | Authentication credentials. |
| api_key.key | string | Yes | Public API key assigned to your CallProof account. |
| api_key.secret | string | Yes | Private API secret associated with the API key. |
| company | object | Yes | Company statistics information. |
| company.html | string | No | HTML content to store for the company statistics. Leading and trailing whitespace is removed. Maximum length is 4,096 characters. |
cURL Example
curl -X POST "https://app.callproof.com/api/companies/stats/html/update/" \
-H "Content-Type: application/json" \
-d '{
"api_key": {
"key": "YOUR_API_KEY",
"secret": "YOUR_API_SECRET"
},
"company": {
"html": "<div>Team calls today: 250</div>"
}
}'
Successful Response (200)
Returns the saved company-level HTML statistics.
| Field | Type | Description |
|---|---|---|
| results | object | Updated company statistics record. |
| results.user_id | null | Always null because company statistics are not associated with an individual user.
|
| results.user | string | Empty string for company-level statistics. |
| results.email | string | Empty string for company-level statistics. |
| results.html | string or null | Stored company HTML statistics. |
| errors | array | Empty when the request succeeds. |
| code | integer | HTTP-style status code (200).
|
Example response:
{
"results": {
"user_id": null,
"user": "",
"email": "",
"html": "<div>Team calls today: 250</div>"
},
"errors": [],
"code": 200
}
Error Responses
| Status Code | Meaning |
|---|---|
| 401 | Unauthorized – The API key or secret is missing, invalid, inactive, associated with a disabled account, or does not have permission to update company statistics. |
| 405 | Method Not Allowed – A method other than POST was used. |
| 500 | Internal Server Error – An unexpected server error occurred. |
401 response example:
{
"results": [],
"errors": [
"Invalid API Key"
],
"code": 401
}
405 response example:
{
"results": [],
"errors": [
"Method not allowed"
],
"code": 405
}
Notes
- This endpoint creates a new company statistics record if one does not already exist; otherwise, it updates the existing record.
- Company statistics are stored independently of individual sales representatives, so the returned
user_id,user, andemailfields are empty. - The HTML content supports up to
4,096characters. - If
company.htmlis omitted or contains only whitespace, any existing HTML content may be cleared. - Authentication credentials are supplied in the JSON request body rather than HTTP headers.
- This endpoint accepts only
POSTrequests with a JSON payload. - This endpoint does not perform field-level validation on the HTML content; therefore, it does not return a
400 Bad Requestresponse for missing or invalid HTML.