Calling a Business Central custom object Rest API v2.0 using Copy Data Activity returns 400 BadRequest
03:05 02 Jul 2026

In a MS Fabric pipeline, I can use a web activity to call a custom object in Bc365 rest api successfully.

However, in the same pipeline (for testing purposes), I have a copy data activity that calls the same api fails.

The url and authentication for both are exactly the same. The lastModifiedDataTime is passed in as raw data - not wrapped in ' '.

This is the error from the copy data activity output:

{
    "copyDuration": 9,
    "errors": [
        {
            "Code": 23353,
            "Message": "ErrorCode=RestCallFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Rest call failed with client error, status code 400 BadRequest, please check your activity settings.\nRequest URL: https://api.businesscentral.dynamics.com//Sandbox/api//v2.0/companies()/?.\nResponse: {\"error\": {\"code\": \"RequestDataInvalid\",\"message\": \"Request data is invalid.\"}},Source=Microsoft.DataTransfer.ClientLibrary,'",
            "EventType": 0,
            "Category": 5,
            "Data": {},
            "MsgId": null,
            "ExceptionType": null,
            "Source": null,
            "StackTrace": null,
            "InnerEventInfos": []
        }
    ],
    "usedDataIntegrationUnits": 4,
    "usedParallelCopies": 1,
    "executionDetails": [
        {
            "source": {
                "type": "RestService"
            },
            "sink": {
                "type": "Lakehouse"
            },
            "status": "Failed",
            "start": "7/2/2026, 9:29:18 AM",
            "duration": 9,
            "usedDataIntegrationUnits": 4,
            "usedParallelCopies": 1,
            "profile": {
                "queue": {
                    "status": "Completed",
                    "duration": 6
                },
                "transfer": {
                    "status": "Completed",
                    "duration": 2
                }
            },
            "detailedDurations": {
                "queuingDuration": 6,
                "transferDuration": 2
            }
        }
    ],
    "dataConsistencyVerification": {
        "VerificationResult": "Unsupported"
    }
}

This is the web activity json - this works

{
    "name": "Get Bc365",
    "type": "WebActivity",
    "dependsOn": [
        {
            "activity": "SetFolderPath",
            "dependencyConditions": [
                "Succeeded"
            ]
        },
        {
            "activity": "SetFileName",
            "dependencyConditions": [
                "Succeeded"
            ]
        }
    ],
    "policy": {
        "timeout": "0.00:10:00",
        "retry": 0,
        "retryIntervalInSeconds": 30,
        "secureOutput": false,
        "secureInput": true
    },
    "typeProperties": {
        "method": "GET",
        "headers": {
            "Authorization": {
                "value": "Bearer @{activity('Get Bc365 Token').output.access_token}",
                "type": "Expression"
            },
            "Accept": {
                "value": "application/json",
                "type": "Expression"
            },
            "Prefer": {
                "value": "odata.maxpagesize=1000",
                "type": "Expression"
            }
        },
        "relativeUrl": {
            "value": "/@{pipeline().libraryVariables.vl_Bc365_Bc365TenantId}/@{pipeline().libraryVariables.vl_Bc365_Bc365UkEnvSandbox}/api/@{pipeline().parameters.ApiPublisher}/@{pipeline().parameters.ApiGroup}/v2.0/companies(@{pipeline().parameters.CompanyId})/@{pipeline().parameters.ApiEntitySetName}?$filter=lastModifiedDateTime gt @{pipeline().parameters.lastModifiedDateTime}",
            "type": "Expression"
        }
    },
    "externalReferences": {
        "connection": "c9d52d7a-xxxx-xxxx-xx71-ecad64ab916e"
    }
}

This is the json for a copy data activity that calls the same business central v2.0 rest api for a custom object.

This one fails

{
    "name": "CopyToDeltaLake",
    "type": "Copy",
    "dependsOn": [
        {
            "activity": "SetFileName",
            "dependencyConditions": [
                "Succeeded"
            ]
        },
        {
            "activity": "SetFolderPath",
            "dependencyConditions": [
                "Succeeded"
            ]
        }
    ],
    "policy": {
        "timeout": "0.01:00:00",
        "retry": 0,
        "retryIntervalInSeconds": 30,
        "secureOutput": false,
        "secureInput": true
    },
    "typeProperties": {
        "source": {
            "type": "RestSource",
            "httpRequestTimeout": "00:01:40",
            "requestInterval": "00.00:00:00.010",
            "requestMethod": "GET",
            "additionalHeaders": {
                "Authorization": {
                    "value": "Bearer @{activity('Get Bc365 Token').output.access_token}",
                    "type": "Expression"
                },
                "Accept": {
                    "value": "application/json",
                    "type": "Expression"
                },
                "Prefer": {
                    "value": "odata.maxpagesize=500",
                    "type": "Expression"
                }
            },
            "paginationRules": {
                "AbsoluteUrl": "$['@odata.nextLink']"
            },
            "datasetSettings": {
                "annotations": [],
                "type": "RestResource",
                "typeProperties": {
                    "relativeUrl": {
                        "value": "/@{pipeline().libraryVariables.vl_Bc365_Bc365TenantId}/@{pipeline().libraryVariables.vl_Bc365_Bc365UkEnvSandbox}/api/@{pipeline().parameters.ApiPublisher}/@{pipeline().parameters.ApiGroup}/v2.0/companies(@{pipeline().parameters.CompanyId})/@{pipeline().parameters.ApiEntitySetName}?$filter=lastModifiedDateTime gt @{pipeline().parameters.lastModifiedDateTime}",
                        "type": "Expression"
                    }
                },
                "schema": [],
                "externalReferences": {
                    "connection": "c9d52d7a-xxxx-xxxx-xx71-ecad64ab916e"
                }
            }
        },
        "sink": {
            "type": "ParquetSink",
            "storeSettings": {
                "type": "AzureBlobStorageWriteSettings",
                "copyBehavior": "FlattenHierarchy"
            },
            "formatSettings": {
                "type": "ParquetWriteSettings",
                "enableVertiParquet": true
            },
            "datasetSettings": {
                "annotations": [],
                "connectionSettings": {
                    "name": "lh_BronzeLayer",
                    "properties": {
                        "annotations": [],
                        "type": "Lakehouse",
                        "typeProperties": {
                            "workspaceId": "29f8113f-xxxx-xxxx-xxf7-d6121b481419",
                            "artifactId": "c6eb7c0f-xxxx-xxxx-xxc1-13b09e22841c",
                            "rootFolder": "Files"
                        },
                        "externalReferences": {
                            "connection": "c443cedf-xxxx-xxxx-xx83-f9c686e9a243"
                        }
                    }
                },
                "type": "Parquet",
                "typeProperties": {
                    "location": {
                        "type": "LakehouseLocation",
                        "fileName": {
                            "value": "@variables('FileName')",
                            "type": "Expression"
                        },
                        "folderPath": {
                            "value": "@variables('FolderPath')",
                            "type": "Expression"
                        }
                    },
                    "compressionCodec": "snappy"
                },
                "schema": []
            }
        },
        "enableStaging": false,
        "translator": {
            "type": "TabularTranslator",
            "typeConversion": true,
            "typeConversionSettings": {
                "allowDataTruncation": false,
                "treatBooleanAsNumber": false
            },
            "columnFlattenSettings": {
                "treatArrayAsString": false,
                "treatStructAsString": false,
                "flattenColumnDelimiter": "."
            }
        }
    }
}

How do I fix the copy data activity?

rest azure-service-fabric dynamics-business-central