### Get a workflow - Ruby Example
Source: https://developer.surense.com/reference/workflows
Demonstrates fetching a workflow using Ruby. This example would typically use the 'Net::HTTP' library or a gem like 'httparty' to perform the HTTP GET request. Replace '{id}' with the target workflow's ID.
```ruby
# Example using Net::HTTP
require 'net/http'
require 'uri'
uri = URI.parse('https://api.surense.com/api/v1/workflows/{id}') # Replace {id}
response = Net::HTTP.get_response(uri)
puts response.body
```
--------------------------------
### Get All Customer Sources - Ruby
Source: https://developer.surense.com/reference/settings
Demonstrates how to fetch all customer sources using Ruby. This example would likely use the 'net/http' library or a gem like 'httparty' to perform the GET request.
```ruby
# Ruby example (using net/http)
require 'net/http'
require 'uri'
uri = URI.parse('https://api.surense.com/api/v1/customers/sources')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
request['accept'] = '*/*'
response = http.request(request)
puts "Status: #{response.code}"
puts "Body: #{response.body}"
```
--------------------------------
### Get Documents URLs Request Example (JSON)
Source: https://developer.surense.com/reference/getdocumentsurls
An example JSON payload for requesting URLs of multiple documents. It specifies document IDs and options for inline display and URL shortening.
```json
{
"documents": [
{
"docId": "7c972d26-8ead-4a71-8eb1-54590052454a",
"inline": false,
"shorten": true
},
{
"docId": "266112d3-7e21-46ac-b181-98e3e9f615bd",
"inline": false,
"shorten": true
}
]
}
```
--------------------------------
### Get All Lead Types API Request (Python)
Source: https://developer.surense.com/reference/leads-settings
Shows a Python example for calling the Surense API to fetch all lead types. This commonly uses the 'requests' library.
```python
# Python example would go here
# Assuming use of the 'requests' library:
/*
import requests
url = "https://api.surense.com/api/v1/leads/types"
headers = {
'accept': '*/*'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print(f"Error: {response.status_code}")
*/
```
--------------------------------
### Get All Lead Types API Request (Ruby)
Source: https://developer.surense.com/reference/leads-settings
Provides an example of how to call the Surense API to get all lead types using Ruby. This would typically involve an HTTP client library.
```ruby
# Ruby example would go here
# Assuming use of the 'net/http' library:
/*
require 'net/http'
require 'uri'
uri = URI.parse('https://api.surense.com/api/v1/leads/types')
request = Net::HTTP::Get.new(uri)
request['accept'] = '*/*'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
*/
```
--------------------------------
### Get All Customer Sources (Python)
Source: https://developer.surense.com/reference/index
This snippet provides a Python example for fetching all customer sources via the API. It utilizes the 'requests' library for making the HTTP GET request.
```python
import requests
url = "https://api.surense.com/api/v1/customers/sources"
headers = {
"accept": "*/*"
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status() # Raise an exception for bad status codes
customer_sources = response.json()
print(customer_sources)
except requests.exceptions.RequestException as e:
print(f"Error fetching customer sources: {e}")
```
--------------------------------
### Get a workflow - Node.js Example
Source: https://developer.surense.com/reference/workflows
Example of how to fetch a workflow using Node.js. This snippet would typically involve using a library like 'axios' or the built-in 'https' module to make the HTTP GET request. Ensure you replace '{id}' with the actual workflow ID.
```javascript
// Example using a hypothetical 'apiClient'
// Replace '{id}' with the actual workflow ID
apiClient.get('/workflows/{id}')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error fetching workflow:', error);
});
```
--------------------------------
### Get All Lead Types API Request (Node.js)
Source: https://developer.surense.com/reference/leads-settings
Shows how to fetch all lead types using the Surense API with Node.js. This example likely uses a fetch or http module and includes the necessary endpoint URL.
```javascript
// Node.js example would go here
// Assuming a fetch-like implementation:
/*
fetch('https://api.surense.com/api/v1/leads/types', {
method: 'GET',
headers: {
'accept': '*/*'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
*/
```
--------------------------------
### Get All Lead Types API Request (cURL)
Source: https://developer.surense.com/reference/leads-settings
Demonstrates how to make a GET request to the Surense API to retrieve all lead types using cURL. It specifies the URL and required headers.
```shell
curl --request GET \
--url https://api.surense.com/api/v1/leads/types \
--header 'accept: */*'
```
--------------------------------
### Retrieve Email Record by ID - Python
Source: https://developer.surense.com/reference/emails
Python example using the 'requests' library to retrieve a specific email record by its UUID. This code makes a GET request to the Surense API. Ensure the 'requests' library is installed (`pip install requests`).
```python
import requests
url = 'https://api.surense.com/api/v1/appmail/id'
headers = {
'accept': '*/*'
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status() # Raise an exception for bad status codes
print(response.json())
except requests.exceptions.RequestException as e:
print(f'Error: {e}')
```
--------------------------------
### Create Activity Request Example
Source: https://developer.surense.com/reference/createactivity
Example JSON payload for creating a new activity. This requires a typeId and htmlContent, with optional fields for customerId, employerId, leadId, workflowId, and meetingId.
```json
{
"typeId": "f2ffc746-0b65-459f-8f48-e3224d80da19",
"htmlContent": "test 123 - content",
"customerId": "2d037b9f-350d-4069-9a19-99b4f67dbf3a"
}
```
--------------------------------
### OpenAPI Definition for Starting Data Import
Source: https://developer.surense.com/reference/startdataimport
This OpenAPI 3.1.0 definition details the 'startDataImport' POST endpoint. It requires a UUID 'id' in the path and returns a 200 OK response. No request body is specified.
```json
{
"openapi": "3.1.0",
"info": {
"title": "API",
"description": "Surense API",
"termsOfService": "https://static.surense.com/terms.htm",
"contact": {
"name": "API Support",
"email": "contact@surense.com"
},
"version": "1"
},
"servers": [
{
"url": "https://api.surense.com/api/v1",
"description": "Production"
}
],
"paths": {
"/data/import/{id}/start": {
"post": {
"tags": [
"Data Import"
],
"summary": "Start a data import",
"operationId": "startDataImport",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
}
}
```
--------------------------------
### Retrieve Email Record by ID - Node.js
Source: https://developer.surense.com/reference/emails
Node.js example for fetching a specific email record by its UUID. It utilizes the 'node-fetch' library to make a GET request to the Surense API. Ensure 'node-fetch' is installed.
```javascript
import fetch from 'node-fetch';
const url = 'https://api.surense.com/api/v1/appmail/id';
const options = {
method: 'GET',
headers: {
'accept': '*/*'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
```
--------------------------------
### POST /websites/developer_surense_reference/leads
Source: https://developer.surense.com/reference/createlead
Creates a new lead by sending lead details in the request body. It supports associating the lead with interests, sources, owners, and customers.
```APIDOC
## POST /websites/developer_surense_reference/leads
### Description
Creates a new lead with specified details.
### Method
POST
### Endpoint
/websites/developer_surense_reference/leads
### Parameters
#### Query Parameters
None
#### Request Body
- **templateId** (string) - Optional - The ID of a template to use for lead creation.
- **interestId** (string) - Required - The ID of the interest associated with the lead.
- **sourceId** (string) - Required - The ID of the source of the lead.
- **ownerId** (string) - Required - The ID of the owner assigned to the lead.
- **assignedUserId** (string) - Required - The ID of the user to whom the lead is assigned.
- **dueDate** (string) - Optional - The due date for the lead in YYYY-MM-DD format.
- **dueTime** (string) - Optional - The due time for the lead.
- **customerId** (string) - Required - The ID of the customer associated with the lead.
- **firstName** (string) - Optional - The first name of the lead.
- **lastName** (string) - Optional - The last name of the lead.
- **idType** (string) - Optional - The type of identification for the lead.
- **idNumber** (string) - Optional - The identification number of the lead.
- **idCardIssueDate** (string) - Optional - The issue date of the lead's ID card.
- **phoneNumber1** (string) - Optional - The primary phone number of the lead.
- **phoneNumber2** (string) - Optional - The secondary phone number of the lead.
- **email** (string) - Optional - The email address of the lead.
- **birthDate** (string) - Optional - The birth date of the lead.
- **managerId** (string) - Optional - The ID of the manager associated with the lead.
### Request Example
```json
{
"templateId": null,
"interestId": "63b7e678-f645-45ab-a9b8-4177282e0d8b",
"sourceId": "adfdc074-81b3-49f7-ab71-111e43932c6d",
"ownerId": "534a38c2-ac29-460f-9441-9fcd05d1a3cb",
"assignedUserId": "534a38c2-ac29-460f-9441-9fcd05d1a3cb",
"dueDate": "2025-09-15",
"dueTime": null,
"customerId": "9b68b34e-3185-464f-b579-894cb517b970",
"firstName": null,
"lastName": null,
"idType": null,
"idNumber": null,
"idCardIssueDate": null,
"phoneNumber1": null,
"phoneNumber2": null,
"email": null,
"birthDate": null,
"managerId": null
}
```
### Response
#### Success Response (200)
- **leadId** (string) - The ID of the newly created lead.
- **message** (string) - A success message.
#### Response Example
```json
{
"leadId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"message": "Lead created successfully"
}
```
```
--------------------------------
### Retrieve Email Record by ID - PHP
Source: https://developer.surense.com/reference/emails
PHP example demonstrating how to fetch a specific email record by its UUID using cURL. This script sends a GET request to the Surense API. Ensure the cURL extension is enabled in your PHP installation.
```php
```
--------------------------------
### POST /leads
Source: https://developer.surense.com/reference/createlead
Creates a new lead in the Surense system. This endpoint allows for the creation of leads with various details such as agency ID, contact information, and status.
```APIDOC
## POST /leads
### Description
Creates a new lead.
### Method
POST
### Endpoint
https://api.surense.com/api/v1/leads
### Parameters
#### Request Body
- **agencyId** (string) - Required - Agency ID
- **externalId** (string) - Optional - External ID
- **templateId** (string) - Optional - Template ID
- **interestId** (string) - Optional - Interest ID
- **sourceId** (string) - Optional - Source ID
- **statusId** (string) - Optional - Status ID
- **ownerId** (string) - Optional - Owner ID
- **assignedUserId** (string) - Optional - Assigned user ID
- **leadDate** (string) - Optional - Lead date (ISO 8601 format)
- **dueAt** (string) - Optional - Due date (ISO 8601 format)
- **dueAtTimeSet** (boolean) - Optional - Whether due time is set
- **notes** (string) - Optional - Lead notes
- **customerId** (string) - Optional - Customer ID
- **firstName** (string) - Optional - First name
- **lastName** (string) - Optional - Last name
- **idType** (integer) - Optional - Identity Type (1: Israeli ID Card, 2: Passport, 3: Driver's License, 4: Other)
- **idNumber** (string) - Optional - Identity number
### Request Example
```json
{
"agencyId": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "EXT123456",
"templateId": "123e4567-e89b-12d3-a456-426614174000",
"interestId": "123e4567-e89b-12d3-a456-426614174000",
"sourceId": "123e4567-e89b-12d3-a456-426614174000",
"statusId": "123e4567-e89b-12d3-a456-426614174000",
"ownerId": "123e4567-e89b-12d3-a456-426614174000",
"assignedUserId": "123e4567-e89b-12d3-a456-426614174000",
"leadDate": "2024-01-15T10:00:00Z",
"dueAt": "2024-01-15T10:00:00Z",
"dueAtTimeSet": true,
"notes": "Important lead information",
"customerId": "123e4567-e89b-12d3-a456-426614174000",
"firstName": "John",
"lastName": "Doe",
"idType": 1,
"idNumber": "123456789"
}
```
### Response
#### Success Response (200)
- **leadId** (string) - The ID of the created lead.
#### Response Example
```json
{
"leadId": "abcdef12-3456-7890-abcd-ef1234567890"
}
```
```
--------------------------------
### Get a workflow - Python Example
Source: https://developer.surense.com/reference/workflows
A Python example for fetching a workflow. This typically involves using the 'requests' library to send an HTTP GET request. Replace '{id}' with the specific workflow ID you want to retrieve.
```python
import requests
workflow_id = '{id}' # Replace with the actual workflow ID
url = f"https://api.surense.com/api/v1/workflows/{workflow_id}"
headers = {
'accept': '*/*'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print(f"Error: {response.status_code}")
```
--------------------------------
### POST /users
Source: https://developer.surense.com/reference/createlead
Creates a new user profile with the provided details. Supports forcing creation even if a user with similar identifiers exists.
```APIDOC
## POST /users
### Description
Creates a new user profile with the provided details. Supports forcing creation even if a user with similar identifiers exists.
### Method
POST
### Endpoint
/users
#### Request Body
- **firstName** (string) - Required - First name of the user.
- **lastName** (string) - Required - Last name of the user.
- **idCardNumber** (string) - Optional - National ID card number.
- **idCardIssueDate** (string) - Optional - ID card issue date (YYYY-MM-DD).
- **email** (string) - Required - Email address.
- **phoneNumber1** (string) - Required - Primary phone number.
- **phoneNumber2** (string) - Optional - Secondary phone number.
- **street** (string) - Optional - Street name.
- **streetNumber** (string) - Optional - Street number.
- **apartmentNumber** (string) - Optional - Apartment number.
- **mailBox** (integer) - Optional - Mail box number.
- **zipCode** (integer) - Optional - ZIP code.
- **city** (string) - Optional - City.
- **gender** (integer) - Optional - Gender (1: Male, 2: Female, 3: Other).
- **birthDate** (string) - Optional - Birth date (YYYY-MM-DD).
- **age** (integer) - Optional - Age of the user.
- **maritalStatus** (integer) - Optional - Marital status (1: Single, 2: Married, 3: Divorced, 4: Widowed, 5: Cohabiting).
- **childCount** (integer) - Optional - Number of children.
- **employerName** (string) - Optional - Name of the employer.
- **smoker** (boolean) - Optional - Indicates if the user is a smoker.
- **monthlyIncome** (integer) - Optional - Monthly income.
- **employmentStatus** (integer) - Optional - Employment status (1: Employed, 2: Unemployed, 3: Self-employed, 4: Student, 5: Retired, 6: Disabled).
- **forceCreation** (boolean) - Optional - If true, forces creation even if a similar user exists.
- **customFields** (array) - Optional - Array of custom fields.
### Request Example
```json
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phoneNumber1": "+972501234567",
"street": "Main Street",
"streetNumber": "123",
"city": "Tel Aviv",
"gender": 1,
"birthDate": "1990-01-15",
"maritalStatus": 2,
"childCount": 2,
"employerName": "ABC Company",
"smoker": false,
"monthlyIncome": 15000,
"employmentStatus": 1,
"forceCreation": false,
"customFields": [
{
"fieldName": "favoriteColor",
"fieldValue": "Blue"
}
]
}
```
#### Success Response (200)
- **userId** (string) - The unique identifier of the created user.
- **message** (string) - Confirmation message.
#### Response Example
```json
{
"userId": "user123abc",
"message": "User profile created successfully."
}
```
```
--------------------------------
### POST /leads
Source: https://developer.surense.com/reference/createlead
Creates a new lead entry in the system. Requires customer and interest identifiers, and optionally accepts UTM parameters for campaign tracking.
```APIDOC
## POST /leads
### Description
Creates a new lead entry in the system. Requires customer and interest identifiers, and optionally accepts UTM parameters for campaign tracking.
### Method
POST
### Endpoint
/leads
### Parameters
#### Query Parameters
- **customerId** (string) - Required - The unique identifier for the customer.
- **interestId** (string) - Required - The unique identifier for the interest.
#### Request Body
- **utmId** (string) - Optional - UTM ID for tracking.
- **utmSource** (string) - Optional - UTM source for tracking.
- **utmMedium** (string) - Optional - UTM medium for tracking.
- **utmCampaign** (string) - Optional - UTM campaign for tracking.
- **utmTerm** (string) - Optional - UTM term for tracking.
- **utmContent** (string) - Optional - UTM content for tracking.
- **customFields** (array) - Optional - An array of custom field entries.
- **fieldId** (string) - Required - The UUID of the custom field.
- **fieldVal** (any) - Required - The value of the custom field.
### Request Example
```json
{
"utmId": "utm123",
"utmSource": "google",
"utmMedium": "cpc",
"utmCampaign": "summer2024",
"utmTerm": "insurance",
"utmContent": "banner",
"customFields": [
{
"fieldId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"fieldVal": "some value"
}
]
}
```
### Response
#### Success Response (200)
- **(object)** - An empty object indicating successful creation.
#### Response Example
```json
{
"message": "Lead created successfully"
}
```
```
--------------------------------
### Get Meeting Request (Ruby)
Source: https://developer.surense.com/reference/meetings
Illustrates how to fetch a specific meeting by its ID using Ruby. This example utilizes the 'net/http' library to perform the GET request.
```ruby
require 'uri'
require 'net/http'
uri = URI.parse('https://api.surense.com/api/v1/meetings/id')
request = Net::HTTP::Get.new(uri)
request['accept'] = '*/*'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body
```
--------------------------------
### POST /data/import/{id}/start
Source: https://developer.surense.com/reference/startdataimport
Initiates a data import process for a specified import ID. This endpoint is part of the Data Import tag.
```APIDOC
## POST /data/import/{id}/start
### Description
Starts a data import process for a given import ID.
### Method
POST
### Endpoint
/data/import/{id}/start
#### Path Parameters
- **id** (string, uuid) - Required - The unique identifier for the data import.
#### Request Body
This endpoint does not require a request body.
### Request Example
(No request body required)
### Response
#### Success Response (200)
- The response indicates that the import process has been started successfully. The exact structure of the response is an object.
#### Response Example
```json
{}
```
```
--------------------------------
### Get Meeting Request (Python)
Source: https://developer.surense.com/reference/meetings
A Python example for fetching a specific meeting by its ID. This code uses the 'requests' library to perform the GET request to the Surense API.
```python
import requests
url = "https://api.surense.com/api/v1/meetings/id"
headers = {
'accept': '*/*'
}
response = requests.get(url, headers=headers)
print(response.json())
```
--------------------------------
### Get Meeting Request (Node.js)
Source: https://developer.surense.com/reference/meetings
Example of retrieving a specific meeting using its ID in Node.js. This code uses the 'node-fetch' library to make the GET request to the Surense API.
```javascript
const fetch = require('node-fetch');
const options = {
method: 'GET',
headers: {
'accept': '*/*'
}
};
fetch('https://api.surense.com/api/v1/meetings/id', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
```
--------------------------------
### OpenAPI 3.1.0 Definition for Surense API
Source: https://developer.surense.com/reference/createlead
This is the core OpenAPI 3.1.0 definition for the Surense API. It specifies the API's title, description, version, server URLs, and available endpoints, including the schema for creating a lead.
```json
{
"openapi": "3.1.0",
"info": {
"title": "API",
"description": "Surense API",
"termsOfService": "https://static.surense.com/terms.htm",
"contact": {
"name": "API Support",
"email": "contact@surense.com"
},
"version": "1"
},
"servers": [
{
"url": "https://api.surense.com/api/v1",
"description": "Production"
}
],
"paths": {
"/leads": {
"post": {
"tags": [
"Leads"
],
"summary": "Create a lead",
"description": "Create a new lead.",
"operationId": "createLead",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Request to create a new lead",
"properties": {
"agencyId": {
"type": "string",
"format": "uuid",
"description": "Agency ID",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"externalId": {
"type": "string",
"description": "External ID",
"example": "EXT123456"
},
"templateId": {
"type": "string",
"description": "Template ID",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"interestId": {
"type": "string",
"description": "Interest ID ",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"sourceId": {
"type": "string",
"description": "Source ID",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"statusId": {
"type": "string",
"description": "Status ID ",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"ownerId": {
"type": "string",
"description": "Owner ID",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"assignedUserId": {
"type": "string",
"description": "Assigned user ID",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"leadDate": {
"type": "string",
"description": "Lead date",
"example": "2024-01-15T10:00:00Z"
},
"dueAt": {
"type": "string",
"description": "Due date",
"example": "2024-01-15T10:00:00Z"
},
"dueAtTimeSet": {
"type": "boolean",
"description": "Whether due time is set",
"example": true
},
"dueDate": {
"type": "string",
"format": "date",
"deprecated": true
},
"dueTime": {
"type": "string",
"deprecated": true
},
"notes": {
"type": "string",
"description": "Lead notes",
"example": "Important lead information"
},
"customerId": {
"type": "string",
"description": "Customer ID",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"managerId": {
"type": "string",
"format": "uuid",
"deprecated": true
},
"firstName": {
"type": "string",
"description": "First name",
"example": "John"
},
"lastName": {
"type": "string",
"description": "Last name",
"example": "Doe"
},
"idType": {
"type": "integer",
"format": "int32",
"description": "Identity Type:
1 - Israeli ID Card
2 - Passport
3 - Driver's License
4 - Other identity document",
"enum": [
"1",
"2",
"3",
"4"
],
"example": 1
},
"idNumber": {
"type": "string",
"description": "Identity number"
}
}
}
}
}
}
}
}
}
}
```
--------------------------------
### Get Meeting Request (PHP)
Source: https://developer.surense.com/reference/meetings
Provides a PHP code snippet for retrieving a specific meeting using its ID. This example uses cURL to send the GET request to the Surense API.
```php
```
--------------------------------
### Create Reminder Request Example (JSON)
Source: https://developer.surense.com/reference/createreminder
An example JSON payload for creating a new reminder. It includes fields like description, due date, and customer ID. This structure is used as input for the reminder creation API endpoint.
```json
{
"delegatedId": "534a38c2-ac29-460f-9441-9fcd05d1a3cb",
"dueDate": "2025-09-15T00:00:00.000Z",
"dueDateTimeSet": false,
"description": "Reminder!",
"customerId": "e0c9f280-19bb-4702-b291-fc8064607d6f"
}
```
--------------------------------
### Get Employer Request (Node.js)
Source: https://developer.surense.com/reference/employers
Example of retrieving a specific employer by its ID using Node.js. This code snippet uses the 'https' module to make the GET request to the Surense API.
```javascript
// Placeholder for Node.js example
// Actual implementation would involve an HTTP client like 'axios' or Node's built-in 'https' module.
```
--------------------------------
### Get Customer by ID using PHP
Source: https://developer.surense.com/reference/customers
This PHP example uses cURL functions to perform a GET request for customer data. It sets the URL and appropriate headers to retrieve the customer information.
```php
```
--------------------------------
### Search Done Tasks Request Example (JSON)
Source: https://developer.surense.com/reference/searchmyworkdone
An example JSON payload for requesting a search of done tasks. It specifies pagination (page, pageSize), sorting (sortBy, sortDir), and a flag for prioritizing reminders.
```json
{
"page": 0,
"pageSize": 30,
"remindersFirst": false,
"sortBy": "doneAt",
"sortDir": "desc"
}
```
--------------------------------
### POST /data/import/initiate
Source: https://developer.surense.com/reference/initiatedataimport
Initiates a data import process. This endpoint allows you to upload files and specify import parameters.
```APIDOC
## POST /data/import/initiate
### Description
Initiates a data import process. This endpoint allows you to upload files and specify import parameters.
### Method
POST
### Endpoint
/data/import/initiate
### Parameters
#### Query Parameters
None
#### Request Body
- **provider** (string, uuid) - Required - The provider identifier for the data import.
- **files** (array) - Required - A list of files to be imported.
- **fileName** (string) - Description: The name of the file.
- **fileSize** (integer, int64) - Description: The size of the file in bytes.
- **params** (object) - Optional - Additional parameters for the import process. Accepts any additional properties.
### Request Example
```json
{
"provider": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"files": [
{
"fileName": "data.csv",
"fileSize": 102400
}
],
"params": {
"delimiter": ",",
"hasHeader": true
}
}
```
### Response
#### Success Response (200)
- The structure of the success response is an object, but specific fields are not detailed in the OpenAPI definition.
#### Response Example
```json
{
"importId": "98765432-10fe-dcba-9876-543210fedcba",
"status": "initiated"
}
```
```
--------------------------------
### Create Employer Request Body Example (JSON)
Source: https://developer.surense.com/reference/createemployer
Example JSON payload for creating a new employer. This structure includes identification details, name, and address information.
```json
{
"idType": 10,
"idNumber": "999457120",
"name": "מעסיק בדיקה",
"street": "תל א",
"streetNumber": "21",
"mailBox": null,
"city": "איזור תעשיה צחר",
"postalCode": "1231400"
}
```
--------------------------------
### Get Employer Request (PHP)
Source: https://developer.surense.com/reference/employers
PHP snippet to retrieve a specific employer by its ID. This example would typically use cURL functions or stream contexts in PHP to make the HTTP GET request.
```php
// Placeholder for PHP example
// Actual implementation would involve cURL or stream contexts.
```
--------------------------------
### Get Customer by ID using Node.js
Source: https://developer.surense.com/reference/customers
This Node.js example shows how to fetch customer data using the 'axios' library. It sends a GET request to the API endpoint with the customer ID and handles the response.
```javascript
const axios = require('axios');
const customerId = 'your_customer_uuid';
axios.get(`https://api.surense.com/api/v1/customers/${customerId}`)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error fetching customer:', error);
});
```
--------------------------------
### Get a workflow - PHP Example
Source: https://developer.surense.com/reference/workflows
This PHP code snippet illustrates how to retrieve a workflow. It would commonly use cURL functions or stream contexts to make the HTTP GET request. Remember to substitute '{id}' with the actual workflow identifier.
```php
// Example using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.surense.com/api/v1/workflows/{id}'); // Replace {id}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array();
$headers[] = 'Accept: */*';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
echo $result;
```
--------------------------------
### Generate Customer Report - Ruby Example
Source: https://developer.surense.com/reference/customers-reports
Ruby code to generate a customer report via the Surense API. It shows how to construct the HTTP POST request with the required parameters and headers.
```ruby
require 'net/http'
require 'uri'
require 'json'
customer_id = 'your_customer_id'
provider_id = 'your_provider_id'
uri = URI.parse("https://api.surense.com/api/v1/customers/#{customer_id}/reports")
request = Net::HTTP::Post.new(uri)
request['accept'] = '*/*'
request['content-type'] = 'application/json'
request.body = {
providerId: provider_id
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body
```
--------------------------------
### POST /supervisors
Source: https://developer.surense.com/reference/createsupervisor
Creates a new supervisor. This operation requires tenant administrator privileges.
```APIDOC
## POST /supervisors
### Description
Create a new supervisor. Requires tenantAdmin permissions.
### Method
POST
### Endpoint
/supervisors
### Parameters
#### Request Body
- **name** (string) - Required - Supervisor name
- **userId** (string) - Optional - User ID
### Request Example
```json
{
"name": "John Doe",
"userId": "123e4567-e89b-12d3-a456-426614174000"
}
```
### Response
#### Success Response (200)
- **(object)** - Description of the response body is not detailed in the OpenAPI spec, but it indicates a successful creation.
#### Response Example
```json
{
"example": "response body"
}
```
```
--------------------------------
### Get All Customer Sources (Ruby)
Source: https://developer.surense.com/reference/index
This snippet shows a Ruby implementation for retrieving all customer sources from the Surense API. It uses the built-in 'net/http' library.
```ruby
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://api.surense.com/api/v1/customers/sources")
request = Net::HTTP::Get.new(uri)
request["accept"] = "*/*"
response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(request)
end
if response.code == '200'
customer_sources = JSON.parse(response.body)
puts customer_sources
else
puts "Error: #{response.code} - #{response.message}"
end
```
--------------------------------
### Get Employer Request (Ruby)
Source: https://developer.surense.com/reference/employers
Ruby code example for fetching a specific employer by its ID via the Surense API. This typically involves using libraries like Net::HTTP or 'httparty'.
```ruby
# Placeholder for Ruby example
# Actual implementation would involve an HTTP client library.
```
--------------------------------
### Update Activity Request Example
Source: https://developer.surense.com/reference/updateactivity
An example JSON payload for updating an activity. This payload requires the 'htmlContent' field, which represents the new content for the activity.
```json
{
"htmlContent": "test 123 - content"
}
```
--------------------------------
### POST /contacts
Source: https://developer.surense.com/reference/createcontact
Create a new contact. At least one contact information is needed (either a phone number or an email address).
```APIDOC
## POST /contacts
### Description
Create a new contact. At least one contact information is needed (either a phone number or an email address).
### Method
POST
### Endpoint
https://api.surense.com/api/v1/contacts
### Parameters
#### Request Body
- **shared** (boolean) - Optional - Whether the contact is shared
- **companyId** (integer) - Optional - Company ID
- **employerId** (string) - Optional - Employer ID
- **description** (string) - Optional - Contact description
- **firstName** (string) - Optional - First name
- **lastName** (string) - Optional - Last name
- **role** (string) - Optional - Role/position
- **phoneNumber1** (string) - Optional - Phone number 1
- **phoneNumber2** (string) - Optional - Phone number 2
- **extensionNumber** (string) - Optional - Extension number
- **faxNumber** (string) - Optional - Fax number
- **email1** (string) - Optional - Email address 1
- **email2** (string) - Optional - Email address 2
- **notes** (string) - Optional - Notes
### Request Example
```json
{
"shared": false,
"companyId": 12345,
"employerId": "123e4567-e89b-12d3-a456-426614174000",
"description": "Main contact person",
"firstName": "John",
"lastName": "Doe",
"role": "Manager",
"phoneNumber1": "+972501234567",
"phoneNumber2": "+972507654321",
"extensionNumber": "123",
"faxNumber": "+972501234567",
"email1": "john.doe@example.com",
"email2": "john.doe2@example.com",
"notes": "Important contact information"
}
```
### Response
#### Success Response (200)
- **[object]** - The response structure is not detailed in the OpenAPI schema.
#### Response Example
```json
{
"example": "response body"
}
```
```
--------------------------------
### Retrieve Email Record by ID - Ruby
Source: https://developer.surense.com/reference/emails
Ruby example using the 'net/http' library to retrieve a specific email record by its UUID. This code sends a GET request to the Surense API endpoint for the specified ID.
```ruby
require 'uri'
require 'net/http'
uri = URI.parse('https://api.surense.com/api/v1/appmail/id')
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
request = Net::HTTP::Get.new(uri)
request['accept'] = '*/*'
response = http.request(request)
puts response.body
end
```
--------------------------------
### POST /activities
Source: https://developer.surense.com/reference/createactivity
This endpoint allows you to create a new activity within the Surense platform. You need to provide details such as the activity type, content, and customer ID.
```APIDOC
## POST /activities
### Description
Create a new activity.
### Method
POST
### Endpoint
/activities
### Parameters
#### Query Parameters
None
#### Request Body
- **typeId** (string) - Required - Activity type ID
- **htmlContent** (string) - Required - Content of the activity
- **customerId** (string) - Optional - Customer ID
- **employerId** (string) - Optional - Employer ID
- **leadId** (string) - Optional - Lead ID
- **workflowId** (string) - Optional - Workflow ID
- **meetingId** (string) - Optional - Meeting ID
### Request Example
```json
{
"typeId": "f2ffc746-0b65-459f-8f48-e3224d80da19",
"htmlContent": "test 123 - content",
"customerId": "2d037b9f-350d-4069-9a19-99b4f67dbf3a"
}
```
### Response
#### Success Response (200)
- The response body will be an object, details not specified in the OpenAPI definition.
#### Response Example
```json
{
"activityId": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
}
```
```