Skip to content

API Integration

To ensure smooth operation, your backend must securely communicate with the OLC Backend API, returning necessary data to be utilized by the SDK frontend.

Key Considerations:

  • Use HTTPS for secure communication.
  • Implement authentication mechanisms as required by your application.
  • Ensure that all endpoints specified in props are correctly implemented in your backend.

API Endpoints:

Template Management:

1. Get All Templates

  • Purpose: Fetch a list of all templates available in the system. This allows the SDK to display options for users to choose from.
  • Endpoint: /api/templates
  • Method: GET
  • Description: Retrieves a list of all available templates. Useful for displaying available templates in the frontend for user selection.
  • Response: A JSON array of template objects, each containing details such as id, name, and created_at.

2. Get One Template

  • Purpose: Retrieve detailed information about a specific template, enabling the SDK to load and edit it.
  • Endpoint: /api/templates/{id}
  • Method: GET
  • Description: Retrieves the details of a specific template by its id.
  • Response: A JSON object containing detailed information about the requested template.

3. Create Template

  • Purpose: Create a new template in the system, allowing the SDK to save new user-created templates.
  • Endpoint: /api/templates
  • Method: POST
  • Description: Creates a new template. Requires the template details to be sent in the request body.
  • Request Body: A JSON object with fields such as name, content, and metadata.
  • Response: A confirmation message with the newly created template’s id.

4. Upload Template

  • Purpose: Upload template files, facilitating bulk additions or uploads from external sources.
  • Endpoint: /api/templates/upload
  • Method: POST
  • Description: Allows the upload of template files. This is useful for adding templates in bulk or uploading templates created in external tools.
  • Request Body: Form data with file attachment.
  • Response: A success message and details of the uploaded template.

5. Update Template

  • Purpose: Update an existing template’s details, supporting ongoing edits via the SDK.
  • Endpoint: /api/templates/{id}
  • Method: PUT
  • Description: Updates an existing template identified by its id.
  • Request Body: A JSON object with the updated fields.
  • Response: A confirmation message and the updated template details.

Custom Field Management

1. Get All Custom Fields

  • Purpose: Retrieve all custom fields associated with templates, allowing dynamic form creation within the SDK.
  • Endpoint: /api/custom-fields
  • Method: GET
  • Description: Retrieves all custom fields associated with templates or other objects. Useful for dynamically building forms or managing metadata.
  • Response: A JSON array of custom field objects, each containing id, name, type, and other relevant details.