Poologics API Documentation (Zapier Integration)

Poologics API Documentation for Zapier Library

Version:

1.0.0

Platform Version:

15.15.0

Authentication

Type: Session-based authentication with a two-step process.

There are two authentication steps required to use the API:

  1. Generate API Key: In order to access the API, you need to generate an API key using the /web/get/key endpoint. This requires providing your login and password.
  2. Test API Key: After generating the API key, you should validate it using the /check_key endpoint to ensure it is correct.

Step 1: Fetch API Key

The API key is retrieved using the provided login and password.

Authentication Request Fields

Field

Required

Description

URL

Yes

Please enter your Poologics URL. Format: https://.v2.poologics.com/

Username

Yes

Please enter your Username.

Password

Yes

Please enter your Password.

API Key

No

Generated API key after login.

Sample Request for Fetching Key:


{
"url": "https:///web/get/key",
"method": "POST",
"headers": {
   "content-type": "application/json",
   "accept": "application/json"
},
"body": {
   "params": {
     "login": "",
     "password": ""
   }
}
}

Step 2: Test API Key

The API key is tested to validate the user session.

Request Template Fields

Field

Required

Description

api_key

Yes

API key for authentication

url

Yes

Poologics API URL

login

Yes

Username for authentication

password

Yes

Password for authentication

Sample Request for Testing Key:


{
"url": "https:///check_key",
"method": "POST",
"headers": {
   "content-type": "application/json",
   "accept": "application/json",
   "API-KEY": ""
},
"body": {
   "params": {}
}
}

Triggers

1. New Opportunity Hooks

Description: Triggers when a new opportunity is created.
Webhook Type: Hook-based

Unsubscribe & Subscribe:

Unsubscribe: Performs a DELETE request to stop the webhook.
Subscribe: Performs a POST request to start the webhook.

Output Fields:

Field

Description

Poologics ID

The unique ID of the opportunity.

Name

The name of the opportunity.

Contact Name

Name of the associated contact.

Email

Email address of the contact.

Description

Description of the opportunity.

Street

Street address of the contact.

City

City of the contact.

ZIP

Postal code of the contact.

State

State of the contact.

Country

Country of the contact.

Phone

Phone number of the contact.

Mobile

Mobile number of the contact.

Stage

Current stage of the opportunity.

 

Sample Output:


{
"poologics_id": "123",
"name": "Opportunity Name",
"contact_name": "John Doe",
"email": "john@example.com",
"description": "Details",
"street": "123 St",
"city": "City",
"zip": "12345",
"state": "State",
"country": "Country",
"phone": "1234567890",
"mobile": "0987654321",
"stage": "Lead"
}

2. New Contact Hook

Description: Triggers when a new contact is created in Poologics.
Webhook Type: Hook-based

Output Fields:

Field

Description

Poologics ID

The unique ID of the contact.

Name

The name of the contact.

Email

Email address of the contact.

Phone

Phone number of the contact.

Mobile

Mobile number of the contact.

Street

Street address of the contact.

City

City of the contact.

ZIP

Postal code of the contact.

State

State of the contact.

Country

Country of the contact.

 

Sample Output:


{
"poologics_id": "123",
"name": "John Doe",
"email": "john@example.com",
"phone": "1234567890",
"mobile": "0987654321",
"street": "123 St",
"city": "City",
"zip": "12345",
"state": "State",
"country": "Country"
}

3. Opportunity Stage Change

Description: Triggers when an opportunity's stage is updated in Poologics.
Webhook Type: Hook-based

Sample Output:

Field

Description

Poologics ID

The unique ID of the opportunity.

Name

The name of the opportunity.

Contact Name

Name of the associated contact.

Email

Email address of the contact.

Description

Description of the opportunity.

Street

Street address of the contact.

City

City of the contact.

ZIP

Postal code of the contact.

State

State of the contact.

Country

Country of the contact.

Phone

Phone number of the contact.

Mobile

Mobile number of the contact.

Stage

Current stage of the opportunity.


{
"poologics_id": "123",
"name": "Opportunity Name",
"contact_name": "John Doe",
"email": "john@example.com",
"description": "Updated details",
"stage": "Qualified"
}

Actions

1. Create Opportunity

Description: Creates a new opportunity in Poologics.

Input Fields:

 

Field

Required

Description

Contact Name

Yes

The name of the contact.

Description

No

The description of the opportunity.

Email

No

Email address of the contact.

Mobile

No

Mobile number of the contact.

Phone

No

Phone number of the contact.

Street

No

Street address of the contact.

City

No

City of the contact.

ZIP

No

Postal code of the contact.

State

No

State of the contact.

Country

No

Country of the contact.

Stage

No

Stage of the opportunity.

 

Sample Request:


{
"url": "https:///web/dataset/create",
"method": "POST",
"headers": {
   "content-type": "application/json",
   "API-KEY": ""
},
"body": {
   "params": {
     "model": "crm.lead",
     "values": {
       "contact_name": "John Doe",
       "email": "john@example.com",
       "mobile": "0987654321",
       "city": "City",
       "stage_id": "Lead"
     }
   }
}
}

Sample Output:


{
"model": "crm.lead",
"id": 493,
"name": "John Doe's Opportunity"
}

2. Create Contact

Description: Creates a new contact in Poologics.

Input Fields:

Field

Required

Description

Name

Yes

The name of the contact.

Email

No

Email address of the contact.

Mobile

No

Mobile number of the contact.

Phone

No

Phone number of the contact.

Street

No

Street address of the contact.

City

No

City of the contact.

ZIP

No

Postal code of the contact.

State

No

State of the contact.

Country

No

Country of the contact.

 

Sample Request:


{
"url": "https:///web/dataset/create",
"method": "POST",
"headers": {
   "content-type": "application/json",
   "API-KEY": ""
},
"body": {
   "params": {
     "model": "res.partner",
     "values": {
       "name": "John Doe",
       "email": "john@example.com",
       "city": "City",
       "mobile": "0987654321"
     }
   }
}
}

Sample Output:


{
"model": "res.partner",
"id": 4304,
"name": "John Doe"
}

3. Change Opportunity Stage

Description: Updates the stage of an opportunity.

Input Fields:

Field

Required

Description

ID

Yes

Record id of object.

Stage

Yes

Stage name.

 

Sample Request:


{
"url": "https:///web/dataset/write",
"method": "POST",
"headers": {
   "content-type": "application/json",
   "API-KEY": ""
},
"body": {
   "params": {
     "model": "crm.lead",
     "values": {
       "record_id": "",
       "stage_id": ""
     }
   }
}
}

Sample Output:


{
"model": "crm.lead",
"id": 499,
"name": "Zap Test Opportunity"
}

 

 

 

 

 

Error Handling Documentation for Poologics API


This documentation covers the error handling implemented in the Poologics API, based on the provided Python code.
Each route includes descriptions of potential errors and corresponding HTTP responses.

1. /web/get/key - Generate API Key

Request Method: POST

Description: Authenticates the user and retrieves an API key.

Error Responses:

Invalid User:


   Condition: If the user does not exist in the system.
   Response:
   {
     "success": false,
     "error": "Invalid User, please try again or contact support@poologics.com"
   }
  

Invalid Password:


   Condition: If the user provides an incorrect password.
   Response:
   {
     "success": false,
     "error": "Invalid password, please try again or contact support@poologics.com"
   }
  

No API Key Found:


   Condition: If the user exists but no associated API key is found.
   Response:
   {
     "success": false,
     "error": "No Api Key found, please try again or contact support@poologics.com"
   }
  

Unexpected Error:


   Condition: Any unforeseen error during the process.
   Response:
   {
     "success": false,
     "error": "An unexpected error occurred. Please contact support@poologics.com"
   }
  

2. /check_key - Validate API Key

Request Method: POST

Description: Verifies if the provided API key is valid.

Error Responses:

Unauthorized Access:


   Condition: If the API key is missing or invalid.
   Response: Handled through default Odoo behavior, returning an HTTP 401 Unauthorized status.
  

3. /zapier/integration - Manage Zapier Webhooks

Request Method: POST

Description: Subscribes or unsubscribes to Zapier webhooks based on the provided trigger and action.

Error Responses:

Invalid Trigger:


   Condition: If the specified trigger does not exist.
   Response:
   {
     "success": false,
     "error": "Subscription failed, Wrong trigger integration, please try again or contact support@poologics.com"
   }
  

Unknown Action:


   Condition: If an action other than 'start' or 'stop' is specified.
   Response:
   {
     "success": false,
     "error": "Unknown Error, please try again or contact support@poologics.com"
   }
  

Subscription Failure:


   Condition: If the subscription request fails.
   Response:
   {
     "success": false,
     "error": "Subscription failed, please try again or contact support@poologics.com"
   }
  

Unsubscribe Failure:


   Condition: If the unsubscribe request fails.
   Response:
   {
     "success": false,
     "error": "Unsubscribe request failed, please try again or contact support@poologics.com"
   }
  

Unexpected Error:


   Condition: Any unforeseen error during the process.
   Response:
   {
     "success": false,
     "error": "An unexpected error occurred. Please contact support@poologics.com"
   }

4. /web/dataset/create - Create Records (Opportunities/Contacts)

Request Method: POST

Description: Creates a new CRM lead (opportunity) or a new contact.

Error Responses:

Missing Required Fields:


   Condition: If required fields (e.g., contact_name) are missing.
   Response:
   {
     "success": false,
     "error": "Required fields are missing. Please ensure all necessary data is provided."
   }
  

Invalid Field Values:


   Condition: If any invalid or incorrectly formatted field values (e.g., email format) are provided.
   Response:
   {
     "success": false,
     "error": "Invalid field values provided. Please check the input and try again."
   }
  

Contact Creation Error:


   Condition: If there is an issue creating the contact.
   Response:
   {
     "success": false,
     "error": "Unable to create contact, please try again or contact support@poologics.com",
     "err_msg": "Detailed error message"
   }
  

Opportunity Creation Error:


   Condition: If there is an issue creating the opportunity.
   Response:
   {
     "success": false,
     "error": "Unable to create opportunity, please try again or contact support@poologics.com",
     "err_msg": "Detailed error message"
   }
  

5. /web/dataset/write - Update Records (Opportunities)

Request Method: POST

Description: Updates an existing CRM lead (opportunity) record.

Error Responses:

Missing Record ID:


   Condition: If the record_id is missing in the request.
   Response:
   {
     "success": false,
     "error": "Unable to edit opportunity ("poologics_id is Required."), please try again or contact support@poologics.com",
     "err_msg": "poologics_id is Required."
   }
  

Record Not Found:


   Condition: If no record matches the provided record_id.
   Response:
   {
     "success": false,
     "error": "Unable to edit opportunity ("No record found."), please try again or contact support@poologics.com",
     "err_msg": "No record found!"
   }
  

Update Error:


   Condition: If there is an issue updating the opportunity record.
   Response:
   {
     "success": false,
     "error": "Unable to update opportunity, please try again or contact support@poologics.com",
     "err_msg": "Detailed error message"
   }
  

6. /web/dataset/get - Retrieve Records (Opportunities)

Request Method: POST

Description: Retrieves CRM lead (opportunity) records based on the given ID.

Error Responses:

Record Not Found:


   Condition: If no record matches the provided ID.
   Response:
   {
     "success": false,
     "error": "No record found with the given ID. Please verify the ID and try again."
   }
  

Unexpected Error:


   Condition: Any unforeseen error during record retrieval.
   Response:
   {
     "success": false,
     "error": "An error occurred while retrieving records. Please try again or contact support@poologics.com"
   }
  

General Notes


   - Status Codes: API routes return a JSON response with either a success or error key.
   Status codes are generally 200 (OK), with custom error messages embedded in the response.
   - Logging: All unexpected errors are logged internally for debugging purposes.