Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

Using functions in Odata Webservices

$
0
0
Hi everyone,

I am creating an extension for integrating via REST webServices with an external application.
First of all, I've created a simple table:
fields
    {
table 50701 "KanbanizeCard"
.....
        field(1; "ID"; Integer)
        {
            Caption = 'ID';
            DataClassification = ToBeClassified;
        }
        field(2; "Nombre"; Text[200])
        {
            Caption = 'Nombre';
            DataClassification = ToBeClassified;
        }
    }
I've published a page for this table as a WebService, and created this function:
}
    [ServiceEnabled]
    procedure AddCard(var actionContext: WebServiceActionContext)
    var
        card: Record KanbanizeCard;
        ODataActionManagement: Codeunit "OData Action Management";
    begin
        ODataActionManagement.AddKey(Rec.FieldNo(ID), Rec.Nombre);
        card.Get(Rec.ID);
        card.Nombre := 'clip';
        card.Modify();
    end;
And I'm calling with post, to this URL:
https://api.businesscentral.dynamics.com/v2.0/xxxxxx-e780-4167-8bff-xxxxxx/SandboxKANBANIZE/ODataV4/Company('CRONUS ES')/KanbanCard(33888)/NAV.AddCard()

The result is not bad, I get the record with 33888 key, and the 'nombre' field is changed to 'clip'.
BUt of course, the goal of this development is to send the new 'nombre' as parameter, not fixed into the code.
How can be this made? I'm reading about this issue, boundary actions and all that, but I don't understand how to define correctly the objets, and how to make the call to the URL... Probably somethin with the actioncContext and OdataActionManagement, but I'm lost.

Any hint will be really appreciated




Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>