GetContractToPdf

Base Endpoint: GET https://api.vlenseg.com/api/BusinessRequest/GetContractToPdf?id={id}

Overview: This endpoint allows admin to download a contract as a PDF by providing the request ID. The response content is in PDF format.

Headers:

  • ApiKey (required): The API key for authenticating the request.

  • TenancyName (required): The tenancy name that identifies the tenant.

  • Authorization (required): Bearer token for user authentication, obtained from the Login API.

  • Content-Type: application/pdf

Download contract as PDF

get

This endpoint allows admin to download the contract PDF by providing the contract ID.

Authorizations
Query parameters
idstringRequired

The unique contract ID to download the PDF

Header parameters
ApiKeystringRequired
TenancyNamestringRequired
AuthorizationstringRequiredExample: Bearer <access_token>
Responses
200

Successfully retrieved the contract PDF

application/pdf
Responsestring · binary
get
/api/BusinessRequest/GetContractToPdf
GET /api/BusinessRequest/GetContractToPdf?id=text HTTP/1.1
Host: 
Authorization: Bearer <access_token>
ApiKey: text
TenancyName: text
Accept: */*
binary
const axios = require('axios');
const fs = require('fs');

const url = 'https://api.vlenseg.com/api/BusinessRequest/GetContractToPdf';
const params = {
    id: '1e83a2e5-3d89-4b30-aa29-21e6171dd388'  // Replace with the actual contract ID
};
const headers = {
    'ApiKey': 'xxx',  // Replace with your actual API key
    'TenancyName': 'Test',  // Replace with your tenancy name
    'Authorization': 'Bearer <access_token>',  // Replace <access_token> with the token returned from the login API
    'Content-Type': 'application/pdf'
};

axios.get(url, { headers, params, responseType: 'arraybuffer' })
    .then(response => {
        fs.writeFileSync('contract.pdf', response.data);
        console.log('PDF saved as "contract.pdf"');
    })
    .catch(error => {
        console.error(`Error: ${error.response.status}`, error.response.data);
    });

Last updated