116 lines
4.9 KiB
Markdown
116 lines
4.9 KiB
Markdown
# CURL Command for Testing addCompanyDetails Lambda
|
|
|
|
## Prerequisites
|
|
1. Replace `YOUR_API_URL` with your actual API Gateway URL
|
|
2. Replace `YOUR_AUTH_TOKEN` with a valid JWT token
|
|
3. Replace file paths with actual document files on your system
|
|
|
|
## Form Data Structure
|
|
|
|
The endpoint expects:
|
|
- `companyDetails`: JSON string containing company information
|
|
- `documents`: JSON string containing array of document metadata
|
|
- File fields: One file field per document (e.g., `panFile`, `gstFile`, etc.)
|
|
|
|
## CURL Command
|
|
|
|
```bash
|
|
curl -X POST "YOUR_API_URL/minglaradmin/add-company-details" \
|
|
-H "x-auth-token: YOUR_AUTH_TOKEN" \
|
|
-F "companyDetails={\"companyName\":\"Test Company\",\"hostRefNumber\":\"HOST001\",\"address1\":\"123 Main St\",\"address2\":\"Suite 100\",\"cityXid\":1,\"stateXid\":1,\"countryXid\":1,\"pinCode\":\"12345\",\"isSubsidairy\":false,\"registrationNumber\":\"REG123456\",\"panNumber\":\"ABCDE1234F\",\"gstNumber\":\"27ABCDE1234F1Z5\",\"formationDate\":\"2020-01-01\",\"companyType\":\"Private Limited\",\"currencyXid\":1}" \
|
|
-F "documents=[{\"documentTypeXid\":1,\"documentName\":\"pan.pdf\",\"fieldName\":\"panFile\"},{\"documentTypeXid\":2,\"documentName\":\"gst.pdf\",\"fieldName\":\"gstFile\"},{\"documentTypeXid\":3,\"documentName\":\"registration.pdf\",\"fieldName\":\"registrationFile\"},{\"documentTypeXid\":4,\"documentName\":\"aadhaar.pdf\",\"fieldName\":\"aadhaarFile\"}]" \
|
|
-F "panFile=@/path/to/pan.pdf" \
|
|
-F "gstFile=@/path/to/gst.pdf" \
|
|
-F "registrationFile=@/path/to/registration.pdf" \
|
|
-F "aadhaarFile=@/path/to/aadhaar.pdf"
|
|
```
|
|
|
|
## Example with Real Values
|
|
|
|
```bash
|
|
curl -X POST "https://abc123.execute-api.ap-south-1.amazonaws.com/minglaradmin/add-company-details" \
|
|
-H "x-auth-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
|
|
-F "companyDetails={\"companyName\":\"Acme Corp\",\"hostRefNumber\":\"HOST001\",\"address1\":\"123 Business Park\",\"address2\":\"Building A\",\"cityXid\":1,\"stateXid\":1,\"countryXid\":1,\"pinCode\":\"400001\",\"isSubsidairy\":false,\"registrationNumber\":\"U12345MH2020PTC123456\",\"panNumber\":\"ABCDE1234F\",\"gstNumber\":\"27ABCDE1234F1Z5\",\"formationDate\":\"2020-01-15\",\"companyType\":\"Private Limited\",\"websiteUrl\":\"https://acme.com\",\"currencyXid\":1}" \
|
|
-F "documents=[{\"documentTypeXid\":1,\"documentName\":\"pan-certificate.pdf\",\"fieldName\":\"panFile\"},{\"documentTypeXid\":2,\"documentName\":\"gst-certificate.pdf\",\"fieldName\":\"gstFile\"},{\"documentTypeXid\":3,\"documentName\":\"registration-certificate.pdf\",\"fieldName\":\"registrationFile\"},{\"documentTypeXid\":4,\"documentName\":\"aadhaar.pdf\",\"fieldName\":\"aadhaarFile\"}]" \
|
|
-F "panFile=@./documents/pan.pdf" \
|
|
-F "gstFile=@./documents/gst.pdf" \
|
|
-F "registrationFile=@./documents/registration.pdf" \
|
|
-F "aadhaarFile=@./documents/aadhaar.pdf"
|
|
```
|
|
|
|
## Postman Setup
|
|
|
|
1. **Method**: POST
|
|
2. **URL**: `YOUR_API_URL/minglaradmin/add-company-details`
|
|
3. **Headers**:
|
|
- `x-auth-token`: `YOUR_AUTH_TOKEN`
|
|
4. **Body**: Select `form-data`
|
|
5. **Add Fields**:
|
|
- `companyDetails` (Text): JSON string with company details
|
|
- `documents` (Text): JSON array string with document metadata
|
|
- `panFile` (File): Select PDF file
|
|
- `gstFile` (File): Select PDF file
|
|
- `registrationFile` (File): Select PDF file
|
|
- `aadhaarFile` (File): Select PDF file
|
|
|
|
## Required Document Types
|
|
|
|
Based on `REQUIRED_DOC_TYPES`:
|
|
- `documentTypeXid: 1` - PAN
|
|
- `documentTypeXid: 2` - GST
|
|
- `documentTypeXid: 3` - REGISTRATION
|
|
- `documentTypeXid: 4` - AADHAAR
|
|
|
|
## Company Details JSON Structure
|
|
|
|
```json
|
|
{
|
|
"companyName": "string (required)",
|
|
"hostRefNumber": "string (required)",
|
|
"address1": "string (required)",
|
|
"address2": "string (optional)",
|
|
"cityXid": "number (required)",
|
|
"stateXid": "number (required)",
|
|
"countryXid": "number (required)",
|
|
"pinCode": "string (required, min 4 chars)",
|
|
"logoPath": "string (optional)",
|
|
"isSubsidairy": "boolean (required)",
|
|
"registrationNumber": "string (required)",
|
|
"panNumber": "string (required)",
|
|
"gstNumber": "string (optional)",
|
|
"formationDate": "string (required, ISO date)",
|
|
"companyType": "string (required)",
|
|
"websiteUrl": "string (optional, must be valid URL)",
|
|
"instagramUrl": "string (optional, must be valid URL)",
|
|
"facebookUrl": "string (optional, must be valid URL)",
|
|
"linkedinUrl": "string (optional, must be valid URL)",
|
|
"twitterUrl": "string (optional, must be valid URL)",
|
|
"currencyXid": "number (required)"
|
|
}
|
|
```
|
|
|
|
## Documents JSON Structure
|
|
|
|
```json
|
|
[
|
|
{
|
|
"documentTypeXid": 1,
|
|
"documentName": "pan.pdf",
|
|
"fieldName": "panFile"
|
|
},
|
|
{
|
|
"documentTypeXid": 2,
|
|
"documentName": "gst.pdf",
|
|
"fieldName": "gstFile"
|
|
}
|
|
]
|
|
```
|
|
|
|
## Notes
|
|
|
|
- All 4 required document types (PAN, GST, REGISTRATION, AADHAAR) must be provided
|
|
- File field names in the `documents` array must match the form field names
|
|
- Files can be PDF, images, or any other document type
|
|
- The endpoint supports both `multipart/form-data` and JSON (for backward compatibility)
|
|
|