Upload PDFs via API
Prerequisites for Using Smart UI
- Familiarity with HTTP APIs is essential.
- Visit the
LambdaTest SmartUI
page and log in with your credentials. - Obtain your
LT_USERNAME
andLT_ACCESS_KEY
by clicking on theAccess Key
button, located at the top right corner of your dashboard.
Step 1: Establishing a SmartUI Project
To initiate a SmartUI PDF Comparison Project, adhere to the following instructions:
- Navigate to the SmartUI Projects Page.
- Tap on the
new project
button. - Specify your platform type as
PDF
. - Provide your
project
name, designateapprovers
, and addtags
(optional). - Confirm your entry by clicking on Submit.
Once your project is active, retrieve your Project Token
from the application. Here's an example of a project token:
projectToken = "123456#1234abcd-****-****-****-************"
Uploading PDFs via API
After setting up your SmartUI Project, you can upload your local PDF files to your project. This will automatically generate a build by capturing snapshots of every page.
Here's how you can upload your PDFs:
-
Retrieve your API
URL Endpoint
post activation of your enterprise plan. To schedule a demonstration, click here. -
Append the following parameters to your request payload via
form-body
:
Variable | Type | Description | Required? |
---|---|---|---|
projectToken | string | This token is required to upload PDF files and validate your project. Example: projectToken:123456#1234abcd-****-****-****-************ | Yes |
pathToFiles | array | Add the path to the PDFs that will be uploaded. Example: pathToFiles : [ "path/to/pdf-1", "path/to/pdf-2"] | Yes |
buildName | string | Assign a name of your choice to the build comprising the uploaded PDFs. Example: buildName : #<Build_Name> | No |
note
Only files in .pdf
format are compatible with this feature.
API Request Example
Here's a sample API request using cURL:
curl -X POST "YOUR_API_ENDPOINT" \
-H "Content-Type: multipart/form-data" \
-F "projectToken=123456#1234abcd-****-****-****-************" \
-F "pathToFiles[]=path/to/document1.pdf" \
-F "pathToFiles[]=path/to/document2.pdf" \
-F "buildName=Release-v2.1"
Response Format
The API will return a JSON response containing:
- Build ID: Unique identifier for the uploaded build
- Status: Upload status (success/failure)
- Pages Captured: Number of pages processed
- Test Results: Visual comparison results (if available)
Use Cases
- Automated CI/CD Integration: Seamlessly integrate PDF testing into your deployment pipeline
- Batch Processing: Upload multiple PDFs simultaneously for efficient testing
- Custom Workflows: Build custom applications that interact with SmartUI programmatically
- Enterprise Integration: Connect with existing enterprise systems and workflows