Skip to content

Error calling API with large ODataKeyFields #8192

@TeconNavBC

Description

@TeconNavBC

Please include the following with each issue:

1. Describe the bug
Calling an personaliced BC API with a text field of 2048 gives the error:

<TITLE>Bad Request</TITLE>

Bad Request - Invalid URL


HTTP Error 400. The request URL is invalid.

2. To Reproduce
Steps to reproduce the behavior:
Create a table i.e.:

table 64000 bigComments

{
Caption = 'Big comments';
DataClassification = SystemMetadata;
fields
{
field(1; Comment; Text[2048])
{
Caption = 'Comment';
}
}
keys
{
key(PK; Comment)
{
Clustered = true;
}
}
}
Then create this API:
page 64000 commentsAPI
{
APIGroup = 'apiu';
APIPublisher = 'tcn';
APIVersion = 'v2.0';
DelayedInsert = true;
EntityName = 'comment';
EntitySetName = 'comments';
Editable = false;
ODataKeyFields = Comment;
PageType = API;
SourceTable = bigComments;
UsageCategory = None;
layout
{
area(Content)
{
field(comment; Rec.Comment) { }
}
}
}

Then call the API with PostMan i.e.:

https://api.businesscentral.dynamics.com/v2.0/YourTennantId/YourEnvironmentId/api/tcn/apiu/v2.0/companies(YourCompanyId)/comments('A large text. Bigger than 241 caracteres')

Then you'll get the error

3. Expected behavior
If the record exists, the real record

4. Actual behavior
An 400 error appears

5. Versions:

  • AL Language: 17.0.2037090
  • Visual Studio Code: 1.108.2
  • Business Central: 27.3.44313.44463
  • List of Visual Studio Code extensions that you have installed:
  • AL Languaje
  • Operating System:
    • Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions