How to get nonce for rest Api call in Business Central AL Code.

How To Create Nonce for Rest API Call In Business Central

Nonce is a random piece of string generated every time for web services call that require nonce in their header part i.e O Auth 1.0 uses nonce to be included in their header request, each time they are random and different for the call purpose.

Scenario :

I need the same random alphanumeric piece of string for the call so what i did was to use a CREATEGUID, copystrand DELCHr methods already included in Business Central side.
For detail please read Microsoft Documentation to be clear about methods used .
💥💪


trigger OnAction()
                begin
                    RandomDigit := CREATEGUID;
                    RandomDigit := DELCHr(RandomDigit, '=''{}-01');
                    RandomDigit := copystr(RandomDigit, 18);
                    result := RandomDigit;
                    Message('Random Digit : %1',result );
                end;

Comments

Popular posts from this blog

Reading json data in Business Central

Consume Rest API in Business Central Code with Basic Auth

How to disable enable action on page dynamically on user selection in Business central