web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

I Need Example how create JSON Port and Send it to API web-servise

(1) ShareShare
ReportReport
Posted on by 4
Hi For All,,,
 
I would like to thank everyone who helps me solve the problems I have,,,,,,,
 
Please excuse me because my English is not strong
 
Required description :-
I am required to Integration with the General Tax Office (Government Side) so that companies can send sales & return invoices in JSON and receive them through the API service
Note : After preparing the invoice in XML format, the file is encoded in Base64 and included in a JSON file with the addition of
Client-ID use (
UBL 2.1 Invoice)
 
2-After the sending process, the server responds with a JSON file containing messages indicating the success of the process and its compliance with the requirements
Its failure
3-If the process is successful, the file contains: The QR Code must be shown on the seller’s invoice
 
I searched for a long time on the Internet and did not find an example......
 
Is there an example of how to get started in AL Code?
 
I have the same question (0)
  • Gerardo Rentería García Profile Picture
    25,225 Most Valuable Professional on at
  • Rami Mazrawi Profile Picture
    4 on at
    thank You gdrenteria ,,,
     
    I write the following code and gave it any data to verify the sending and receiving From URL,,,,, but a appear error appears in the image.
     
    the Code Photo :
    ===================================================================================================
    ===================================================================================================
    the code Text :
    procedure SendInvoiceWithAuthentication(EncryptedXMLBase64: Text[1000]; ClientID: Text[200]; SecretKey: Text[500])
        var
            HttpClient: HttpClient;
            HttpRequestMessage: HttpRequestMessage;
            HttpResponseMessage: HttpResponseMessage;
            RequestHeaders: HttpHeaders;
            JsonToken: JsonToken;
            JsonObject: JsonObject;
            BodyText: Text;
            BaseUrl: Text;
            ResponseContent: Text;
        begin
            BaseUrl := 'https://backend.jofotara.gov.jo/core/invoices/';
            HttpRequestMessage.SetRequestUri(BaseUrl);
            HttpRequestMessage.Method('POST');
            // إضافة رؤوس الطلب ********************************************
            HttpRequestMessage.GetHeaders(RequestHeaders);
            RequestHeaders.Add('Client-Id', ClientID);
            RequestHeaders.Add('Secret-Key', SecretKey);
            RequestHeaders.Add('Content-Type', 'application/json');
            // إعداد جسم الطلب *********************************************
            JsonObject.Add('invoice', EncryptedXMLBase64);
            JsonObject.WriteTo(BodyText);
            HttpRequestMessage.Content.WriteFrom(BodyText);
            // إرسال الطلب والتعامل مع الرد ********************************
            if HttpClient.Send(HttpRequestMessage, HttpResponseMessage) then begin
                HttpResponseMessage.Content.ReadAs(ResponseContent);
                if HttpResponseMessage.IsSuccessStatusCode then begin
                    // الرد ناجح
                    // هنا يمكن تحليل الرد ومعالجة QR Code أو غيره
                    Message('Success: %1', ResponseContent);
                end else begin
                    // الرد يدل على وجود خطأ
                    Message('Error: %1', ResponseContent);
                end;
            end else begin
                Message('Failed to send request.');
            end;
        end;
     
     
    Please help me solve the problem and understand what is happening
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,917

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,161 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,025 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans