MobileApp
Create Template
Changed onFunction: create_template Type: API Endpoint (POST)
Purpose: Creates a new template in the database for the provided template data. It generates a unique template code, checks for existing templates, and adds the new template and associated pages to the database.
URL: POST /templates/create
Headers:
- Customer_Key (str, required): Encoded customer key for authorization.
Request Body:
- template_data (TemplateDataRequest): The data for the template, including application code, report code, template name, and other details.
Process:
- Decode and validate the Customer_Key.
- Iterate through each item in template_data.
- Generate a unique template code.
- Check if a template already exists for the report code.
- Create a new template and add it to the database.
- If is_page is True, create associated pages.
- Update the serial number for the template code.
Response:
- Returns a success message if the template is created successfully.
- Returns error messages if the customer key is invalid, a template already exists, or a page already exists.
Error Handling:
- Catches exceptions and returns a 500 error with the exception message.
post/api/MobileApp/templates/create
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
Customer-Keystring required
Request body
Response
Successful Response
unknown required
Changes
- info
endpoint added
- info