GetGRDocumentById (GET)

Overview

This GET API retrieves the complete Goods Receipt (GR) document by its documentId. The endpoint composes the response by calling the GR Header API and the GR Line API internally, then merges the header with its lines into a single document. If the 'SendCommentsandattachmentsOutbound' configuration is enabled for the LOB, comments and attachments are also appended.

URL Format: https://<Instance>/leo-gr-domaingateway-api/api/v1/GetGRDocumentById?documentId=<documentId>

 

Notes / Behavior:

  - documentId is a REQUIRED query string parameter.

  - Internally calls: /leo-gr-header-api/api/v1/Header/GetGRHeader?documentId=... and /leo-gr-line-api/api/v1/Line/GetLine?documentId=...

  - When the GR exists: returns { isSuccess: true, message: '', result: <full GR document with grLine[]> }

  - When no GR is found: returns { isSuccess: true, message: 'No record found', result: {} }

  - On internal exception: HTTP 500 with the exception message in the body.

Request
GET https://api-leoqc.gep.com/leo-gr-domaingateway-api/api/v1/GetGRDocumentById?documentId=<documentId>

This is a GET endpoint - there is no request body. The documentId is passed as a query string parameter.
Response
{
    "message": "",
    "isSuccess": true,
    "result": {
        "_id": "0495fd0b-cb33-4eed-a006-ca9c6a884a82",
        "documentId": "0495fd0b-cb33-4eed-a006-ca9c6a884a82",
        "grHeaderId": "0495fd0b-cb33-4eed-a006-ca9c6a884a82",
        "rootId": "0495fd0b-cb33-4eed-a006-ca9c6a884a82",
        "grNumber": "GR-2026.008835",
        "documentName": "AutomReceipt202606202248iA0",
        "status": "Draft",
        "statusId": 1,
        "subTypeAppId": "39dd1c6a-2edc-40c7-b0d4-2e50755eb941",
        "subType": 1,
        "grType": 1,
        "orderNumber": "PO-2026-036249",
        "supplierCode": "PC-2024.004228",
        "documentDate": "2026-06-20T22:48:19Z",
        "postingDate": "2026-06-20T22:48:19Z",
        "createdBy": "P2PAutomation Buyer",
        "createdOn": "2026-06-20T22:48:19Z",
        "updatedBy": "P2PAutomation Buyer",
        "updatedOn": "2026-06-20T22:48:47Z",
        "currency": { "code": "USD", "name": "US Dollar", "isActive": true },
        "supplier": { "...": "supplier object" },
        "businessUnit": [ { "entityCode": "BU5", "entityName": "Business Unit 5" } ],
        "shipToAddress": { "...": "address object" },
        "linkedDocuments": { "...": "linked PO references" },
        "auditFields": { "...": "audit fields" },
        "totalOrderedQuantity": 80,
        "totalReceivedQuantity": 80,
        "totalAcceptedQuantity": 80,
        "totalReturnedQuantity": 0,
        "grLine": [
            {
                "_id": "29a58111-a80e-4617-a48b-4eeb8933c9e6",
                "grLineId": "29a58111-a80e-4617-a48b-4eeb8933c9e6",
                "grLineNumber": "1",
                "poNumber": "PO-2026-036249",
                "poLineNumber": "1",
                "orderedQuantity": 20,
                "receivedQuantity": 20,
                "deliveredQty": 20,
                "lineType": "Material",
                "itemName": "Laptop",
                "itemUOM": "EA",
                "unitPrice": 10,
                "status": "Draft"
            }
        ],
        "attachments": [],
        "comments": []
    }
}
Examples
Success Scenario - Request
curl --location 'https://api-leoqc.gep.com/leo-gr-domaingateway-api/api/v1/GetGRDocumentById?documentId=0495fd0b-cb33-4eed-a006-ca9c6a884a82' \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>' \
--header 'ocp-apim-subscription-key: <subscription-key>' \
--header 'subtypeappid: 39dd1c6a-2edc-40c7-b0d4-2e50755eb941' \
--header 'appid: 39dd1c6a-2edc-40c7-b0d4-2e50755eb941'

Success Scenario - Response (record found)
{
    "message": "",
    "isSuccess": true,
    "result": {
        "documentId": "0495fd0b-cb33-4eed-a006-ca9c6a884a82",
        "grNumber": "GR-2026.008835",
        "status": "Draft",
        "grLine": [ { "grLineNumber": "1", "poNumber": "PO-2026-036249", "receivedQuantity": 20 } ],
        "...": "remaining header fields"
    }
}

No Record Scenario - Response
{
    "message": "No record found",
    "isSuccess": true,
    "result": {}
}

Failure Scenario - Response
HTTP/1.1 500 Internal Server Error
Content-Type: text/plain
 
Object reference not set to an instance of an object.
Data Elements
PropertyRequired?Data typeDescriptionValidations / Exceptions
Request Headers    
acceptYesStringResponse media type. Use application/json. 
authorizationYesStringBearer token used for authentication. 
ocp-apim-subscription-keyYesStringAPIM subscription key issued to the consumer. 
subtypeappidYesGUID (String)Sub-type application identifier of the GR module. Value: 39dd1c6a-2edc-40c7-b0d4-2e50755eb941. 
appidYesGUID (String)Application identifier. Value: 39dd1c6a-2edc-40c7-b0d4-2e50755eb941. 
x-gep-transaction-scope-id GUID (String)Optional correlation id for tracing. 

 

PropertyRequired?Data typeDescriptionValidations / Exceptions
Query String Parameters    
documentIdYesString (GUID)Document id of the Goods Receipt to retrieve.Must be a valid existing GR documentId

 

PropertyRequired?Data typeDescriptionValidations / Exceptions
GetGRDocumentById Response    
message StringEmpty on success. 'No record found' when the documentId does not exist. 'Something went wrong' on unexpected failure. 
isSuccess BooleanTrue when the call succeeded (including the 'No record found' case). False on unhandled failure. 
result ObjectThe full GR document (header fields merged with grLine array). Empty object {} when no record is found. 

 

The 'result' object mirrors the same structure used by CreateGR / SaveDocument / Update. For field-level details of the header and grLine items, refer to sections 3 (SaveDocument) - the schemas are identical.