2. View extraction

POST /viewExtraction

This endpoint retrieves the details of an extraction process previously defined in the system. By submitting the unique extractionId, you can obtain information such as the extraction name, language, options set, and the fields that are being extracted. This is useful for verifying the setup of your extraction template or for debugging purposes.

Postman Collection

For a complete and interactive set of API requests, please refer to our Postman Integrationcollection.

Server URL

https://api.extracta.ai/api/v1

Headers

NameValue

Content-Type

application/json

Authorization

Bearer <token>

Body

NameTypeRequiredDescription

extractionId

string

true

Unique identifier for the extraction.

Body Example

{
    "extractionId": "extractionId"
}

Code Example

const axios = require('axios');

/**
 * Retrieves details of an extraction process by its unique extractionId.
 * 
 * @param {string} token - The authorization token to access the API.
 * @param {string} extractionId - The unique identifier for the extraction.
 * @returns {Promise<Object>} The promise that resolves to the extraction details.
 */
async function viewExtraction(token, extractionId) {
    const url = "https://api.extracta.ai/api/v1/viewExtraction";

    try {
        const response = await axios.post(url, {
            extractionId: extractionId
        }, {
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${token}`
            }
        });

        // Handling response
        return response.data; // Directly return the parsed JSON response
    } catch (error) {
        // Handling errors
        throw error.response ? error.response.data : new Error('An unknown error occurred');
    }
}

async function main() {
    const token = 'apiKey';
    const extractionId = 'extractionId';

    try {
        const extractionDetails = await viewExtraction(token, extractionId);
        console.log("Extraction Details:", extractionDetails);
    } catch (error) {
        console.error("Failed to retrieve extraction details:", error);
    }
}

main();

Responses

{
    "extractionId": "extractionId",
    "extractionDetails": {
        "status": "has batches",
        "batches": {
            "33NjeFksJFZVTpLWSFSrlWkxy": {
                "filesNo": 3,
                "origin": "api",
                "startTime": "1699370066649",
                "status": "finished"
            },
            ...
        },
        "name": "API CVs",
        "description": "...",
        "language": "English",
        "options": {
            "handwrittenTextRecognition": true,
            "hasTable": false
        },
        "fields": [
            {
                "description": "",
                "example": "",
                "key": "name"
            },
            ...
        ],
    }
}

Last updated