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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Code to call APIs from X++

(1) ShareShare
ReportReport
Posted on by 184

Hi All,

I have a requirement for calling an API to send customer payment details to a thrid party tool.

I have two APIs  

1. API for Token

2. API for Payment

Please suggest me how can I achieve via x++, any sample code would be much appreciated?

APIs based of standard header authentication .

And I client has the following to me

1. Token URL

2. API URL

3. CLient ID

4. Secret

Please suggest some answers

I have the same question (0)
  • Suggested answer
    Komi Siabi Profile Picture
    13,093 Most Valuable Professional on at

    Hi D365_Wibes,

    Firstly test, the API on post and confirm you are able to communicate with it.

    Create a new project using C# Class Library (.Net Framework) template

    Create a class that consumes the third party API

    Create D365 F&O project

    Add DLL as reference to newly created project

    Create a Runnable class to consume the DLL.

    Here you can get a code sample for based connection.

    blog.monsieurwinner.com/.../

  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    API stands for Application Programing Interface and it's an extremely generic term. You should be more specific.

    I guess you mean a RESTful web service. Is it the case?

  • D365_Wibes Profile Picture
    184 on at

    Thanks for the URL Siabi. Let me try this and update you

  • D365_Wibes Profile Picture
    184 on at

    Hi Martin,

    Yes its a restful service.

    Can you please suggest some code for me, such as how to consume it via x++ or c#?

  • D365_Wibes Profile Picture
    184 on at

    Can you please suggests some blogs by which following which I can achieve this?

  • D365_Wibes Profile Picture
    184 on at

    Hi Martin,

    Can you please suggest some code? I am not sure how to achieve this

  • Suggested answer
    Komi Siabi Profile Picture
    13,093 Most Valuable Professional on at

    Hi D365_Wibes,

    Please, are you saying, you did not get anything from the link I shared?

  • D365_Wibes Profile Picture
    184 on at

    Thanks for sharing that Siabi

    But the link you have shared via which I can get the JSON,

    but I should also have to write some thing in it and send it back to 3rd party tool...

    Let me tell you my full requirement.

    1. In D365 FO on daily basis I need to push customer payments posted against an Invoice for the day to a

      3rd party tool,

    2.  I will write a batch service which will run on every night. Now I want to incorporate the api in the batch

       service.

    3. I have the valid JSON format with me available ready.  I just have to write some values into the JSON and send it to the 3rd party via POST api call.

    Hope I have explained little better about my requirement. Kindly suggest me accordingly to achieve the requirement

  • D365_Wibes Profile Picture
    184 on at

    Hi Siabi,

    Can you please suggest something?

  • Komi Siabi Profile Picture
    13,093 Most Valuable Professional on at

    Hi D365_Wibes ,

    I think, my major question will be, are you able to connect to the service in your X++ project as we write?

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 663 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 540 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 348 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans