Help and support
Form Design API: Your Gateway to Data Extraction
The Form Design functionality in Artificio is at the heart of its data extraction prowess. It allows you to visually construct forms that define the data you want to collect. More importantly, each form you design can be instantly transformed into a functional API, ready for integration.
1. How to Design a Form
- Navigate to Form Designer: From your Artificio dashboard, locate and click on the "Form Design" or "Create App Form Design" button.
- Name Your Form: Provide a meaningful name for your form (e.g., "TimesheetsData"). This name will typically be used in the generated API endpoint.
- Add Fields: Drag and drop various field types onto your form canvas. Artificio offers a range of field types to suit your data needs:
- Text Field: For short text inputs (e.g.,
consultantName,companyName). - Text Area: For longer text inputs.
- Number Field: For numerical data (e.g.,
hourlyRate,hours,amount). - Email Field: For email addresses with built-in validation (e.g.,
companyEmail). - Date Field: For capturing dates.
- Dropdown/Select: For predefined options.
- Checkbox: For boolean values.
- Radio Button: For single selection from multiple options.
- File Upload: Crucial for attaching files (e.g.,
file_dataflow-90105-Auto_Receipts).
- Text Field: For short text inputs (e.g.,
- Configure Field Properties: For each field you add:
- Label: Provide a user-friendly label (e.g., "Consultant Name").
- Field Name (API Parameter Name): This is critical! Define a unique, descriptive name that will be used as the parameter in your API (e.g.,
consultantName). Ensure these names are clear and consistent. - Validation Rules: Apply validation rules as needed. Common validations include:
- Required: Ensures the field cannot be left blank (e.g.,
consultantName,hourlyRate,hours,amount). - Min/Max Length: For text fields.
- Min/Max Value: For number fields.
- Required: Ensures the field cannot be left blank (e.g.,
- Save Your Form: Once you are satisfied with your form design, click "Save." Artificio will then automatically generate the corresponding API.
- Click on the API Option from the list to see the details and you can copy the API parameters.
You can now access the API Parameters modal for this particular form design to proceed
1.2 Example: Designing the TimesheetsData Form
Based on the provided example, here's how you would design the "TimesheetsData" form in Artificio:
| Field Label | Field Type | Field Name (API Parameter) | Validation |
| Consultant Name | Textfield | consultantName | Required |
| Company Name | Textfield | companyName | None |
| Hourly Rate | Textfield | hourlyRate | Required |
| Hours Worked | Textfield | hours | Required |
| Week | Textfield | week | None |
| Company Email | companyEmail | None | |
| Amount | Textfield | amount | Required |
| Customer Ref Value | Textfield | customerRefValue | None |
| Auto Receipts File | File | file_dataflow-90105-Auto_Receipts | None |
| Additional Text | Textfield | textField | None |
| Detail Type | Textfield | detailType | None |
2. API Generation and Usage
Once your form is designed and saved, Artificio automatically generates a RESTful API endpoint. This API acts as an interface through which external applications can submit data to your Artificio form.
2.1 API Information (TimesheetsData Example)
- Endpoint:
POST https://api-dev.np-artificio.com/external/forms/TimesheetsData- Method:
POSTis used to send data to the server to create or update a resource. - URL: The base URL for Artificio's external forms API, followed by your form's name (
TimesheetsData).
- Method:
2.2 API Parameters
These are the fields defined in your Artificio form, which correspond to the data you expect to receive.
| Parameter Name | Type | Validation | Description |
consultantName | textfield | Required | Name of the consultant. |
companyName | textfield | Optional | Name of the company. |
hourlyRate | textfield | Required | The consultant's hourly rate. |
hours | textfield | Required | Number of hours worked. |
week | textfield | Optional | The week for which the timesheet applies. |
companyEmail | email | Optional | Email address of the company. |
amount | textfield | Required | The total amount for the timesheet. |
customerRefValue | textfield | Optional | A reference value for the customer. |
file_dataflow-90105-Auto_Receipts | file | Optional | File attachment, potentially for receipts or related documents. |
textField | textfield | Optional | An additional text field for miscellaneous data. |
detailType | textfield | Optional | Specifies the type of detail for the timesheet entry. |
2.3 Body Parameters (JSON Example for Non-File Data)
When sending data to the API, you typically structure it as a JSON object for most fields. However, for file uploads, multipart/form-data is required.
JSON
{
"consultantName": "John Doe",
"companyName": "ABC Solutions",
"hourlyRate": "50.00",
"hours": "40",
"week": "2025-W28",
"companyEmail": "info@abcsolutions.com",
"amount": "2000.00",
"customerRefValue": "CRV-12345",
"file_dataflow-90105-Auto_Receipts": "YOUR_FILE_DATA_HERE", // This will be handled differently in multipart/form-data
"textField": "Project X timesheet",
"detailType": "Consulting Services"
}
2.4 cURL Command Example for API Interaction
The cURL command is a versatile tool for making HTTP requests and is excellent for testing your API. The provided cURL command demonstrates how to send data to your Artificio form API.
curl -X POST https://api-dev.np-artificio.com/external/forms/TimesheetsData \
-H 'X-API-Key: YOUR_ARTIFICIO_API_KEY' \
-H 'Content-Type: multipart/form-data' \
-F 'consultantName=John Doe' \
-F 'companyName=ABC Solutions' \
-F 'hourlyRate=50.00' \
-F 'hours=40' \
-F 'week=2025-W28' \
-F 'companyEmail=info@abcsolutions.com' \
-F 'amount=2000.00' \
-F 'customerRefValue=CRV-12345' \
-F 'file_dataflow-90105-Auto_Receipts=@/path/to/your/receipt.pdf' \
-F 'textField=Project X timesheet' \
-F 'detailType=Consulting Services'
Key Elements of the cURL Command:
-X POST: Specifies the HTTP method as POST.https://api-dev.np-artificio.com/external/forms/TimesheetsData: The target API endpoint.-H 'X-API-Key: YOUR_ARTIFICIO_API_KEY': Crucial for authentication. You must replaceYOUR_ARTIFICIO_API_KEYwith the actual API key generated from your Artificio account. This key authenticates your request.-H 'Content-Type: multipart/form-data': Indicates that the request body is sent asmultipart/form-data, which is necessary when uploading files.-F 'parameterName=value': Used to send form data.- For regular text fields, provide the field name and its value (e.g.,
-F 'consultantName=John Doe'). - For file uploads, use
-F 'file_dataflow-90105-Auto_Receipts=@/path/to/your/receipt.pdf'. The@symbol tells cURL to read the content of the specified file. Replace/path/to/your/receipt.pdfwith the actual path to the file on your system.
- For regular text fields, provide the field name and its value (e.g.,
2.5 Integrating with Other Applications
The generated API can be integrated into virtually any application that can make HTTP requests. Here's a general approach:
- Identify Your Application's HTTP Client: Most programming languages (Python, JavaScript, Java, C#, PHP, etc.) have built-in libraries or popular third-party clients for making HTTP requests (e.g.,
requestsin Python,fetchin JavaScript,HttpClientin C#). - Construct the Request:
- URL: Use the API endpoint provided by Artificio.
- Method: Set the method to
POST. - Headers: Include the
X-API-Keyheader with your Artificio API key and theContent-Type: multipart/form-dataheader if you are sending files. - Body: Construct the request body using key-value pairs corresponding to your form fields. For file uploads, ensure your HTTP client handles
multipart/form-datacorrectly.
- Handle the Response: After making the request, the Artificio API will typically return a JSON response indicating success or failure.
- Success: A 2xx status code (e.g., 200 OK, 201 Created) usually means the data was successfully received and processed by Artificio. The response might include a confirmation message or an ID for the submitted data.
- Failure: A 4xx or 5xx status code indicates an error (e.g., 400 Bad Request for missing required fields, 401 Unauthorized for invalid API key, 500 Internal Server Error). The response body will often contain an error message detailing the issue.
Where to Find Your API Token:
Your API Token is securely generated within your Artificio account. You can typically find it in one of these locations:
- API Tokens: Look for a section like "Super Admin" within your Artificio dashboard.
Once found, treat your API Token like a password. Do not share it publicly or embed it directly in client-side code where it can be easily exposed.