MobileApp

Create Template Pages

Changed on

Function: create_template_pages Type: API Endpoint (POST)

Purpose: Creates new template pages in the database for the provided template data. It assigns a unique report_seq to each report and adds the new pages to the database.

URL: POST /templates/create_template_pages

Headers:

  • Customer_Key (str, required): Encoded customer key for authorization.

Request Body:

  • template_data (TemplatePagesRequest): The data for the template, including application code, report code, template name, and other details.

Process:

  1. Decode and validate the Customer_Key.
  2. Iterate through each item in template_data.
  3. Generate a unique report_seq for each report.
  4. Check if a report already exists for the report code.
  5. If not existing, create new template pages and add them to the database.
  6. Commit changes for each report separately.

Response:

  • Returns a success message if the template pages are created successfully.
  • Returns error messages if the customer key is invalid, the template code is invalid, or a database error occurs.

Error Handling:

  • Catches exceptions and returns a 500 error with the exception message.
post/api/MobileApp/templates/create_template_pages

Request

Headers

Customer-Keystring required

Request body

Response

Successful Response

unknown required

Changes