Create Basic Details
Changed onFunction: create_basic_details
Type: API Endpoint (POST)
Purpose:
Creates a new template with the given details and saves the initial template details.
Endpoint:
POST /api/templates/create_basic_details
Request Headers:
- Customer-Key (str, required): A base64 encoded string containing lscode and firmcode for the customer. This must be decoded for database access.
Request Body:
- template_data (TemplateCreateRequest, required): Contains the template name, report code, format, email subject, email body, email CC and BCC, and status.
Response:
- Returns a JSON object containing the newly created template code, template name, format, email subject, email body, email CC and BCC, and status.
Exceptions:
- Handles exceptions related to invalid customer key format, missing idx for update/delete operations, and database errors, providing appropriate error messages.
Steps:
-
Customer Key Decoding:
Decodes the Customer_Key to extract the lscode and firmcode. Raises an error if the format is invalid. -
Input Validation:
Validates the presence of template_name, report_code, format, email_subject, and email_body in the request body. -
Database Connection:
Establishes a connection to the database using custCursorConnection. -
Template Creation:
Creates a new template with the given details and saves the initial template details. -
Transaction Handling:
Commits the transaction if all operations are successful, or rolls back in case of an error. -
Logging:
Logs the API call with details of the operation. -
Response Construction:
Returns a success message or error details based on the outcome of the operations.
Request
- Base URLhttps://api.leapsurgebi.com (the document declares no server; this is the origin it was published from)
- AuthOAuth 2PasswordToken URL/auth/token
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Headers
Request body
Response
Successful Response
Changes
- info
endpoint added
- info