Skip to content

Problem with "PageType = API" - not working? #1283

@megel

Description

@megel

I have tried to create an API page like:

page 50102 MyInfo
{
    PageType       = API;
    EntityName     = 'myInfo';
    EntitySetName  = 'myInfos';
    APIVersion     = 'beta';
    SourceTable    = "My Infos";
    ODataKeyFields = "Id";
    layout
    {
        area(content)
        {
            field("Id"; Id) {}
            field("Item No.";"Item No.") {}
            field("Item Id";"Item Id") {}            
        }
    }
}

I have also tried to extend an existing API page e.g. Customer Entity

pageextension 50101 "Customer Entity Ext" extends "Customer Entity"
{
    layout
    {
        addlast(content)
        {
            field("myData"; 'sss') { ApplicationArea = All; }            
        }
    }
}

My NAV Version is:
grafik
I have enabled the API in CustomSettings.config:

  <!-- Specifies whether the API web services are enabled. -->
  <add key="ApiServicesEnabled" value="true" />

The new API-Page was not present, when I have tried to query by Postman with URL:
....azure.com:7048/NAV/api/beta/myInfos/

The existing API-Page (Customer Entity) did not contain the new Field.

{
    "@odata.context": "....azure.com:7048/NAV/api/beta/$metadata#customers",
    "value": [
        {
            "@odata.etag": "W/\"JzM2O0VnQUFBQUo3Q0RRQU5nQTRBRGtBTndBNEFEZ0FPUUFBQUFBQTY7MzE3ODU5MDsn\"",
            "id": "14cad1e0-db33-418f-a14a-00a4bf4623aa",
            "number": "46897889",
            "displayName": "Englunds Kontorsmöbler AB",
            "type": "Company",
            "phoneNumber": "",
            "email": "",
            "website": "",
            "taxLiable": false,
            "taxAreaId": "7eba3574-f889-49c0-876b-7c416f552c6f",
            "taxAreaDisplayName": "Debitoren und Kreditoren in EU",
            "taxRegistrationNumber": "777777777701",
            "currencyId": "0685ebce-5c90-4786-82d3-da6f206b7df5",
            "currencyCode": "SEK",
            "paymentTermsId": "487c7f01-7d6f-4764-af77-5d07ed7ee392",
            "shipmentMethodId": "093a2f3a-c4a8-488e-aac4-7f3050cc0ecc",
            "paymentMethodId": "00000000-0000-0000-0000-000000000000",
            "blocked": " ",
            "balance": 1043.55,
            "overdueAmount": 0,
            "totalSalesExcludingTax": 0,
            "lastModifiedDateTime": "2017-11-23T02:12:37.593Z",
            "address": {
                "street": "Kungsgatan 18",
                "city": "Norrköping",
                "state": "",
                "countryLetterCode": "SE",
                "postalCode": "600 03"
            },
            "paymentTerms": {
                "code": "LM",
                "description": "Laufender Monat"
            },
            "shipmentMethod": {
                "code": "EXW",
                "description": "Ab Warenhaus"
            },
            "paymentMethod": null
        }
   ]
}```
Where is my fault?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis is an enhancement suggestion to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions