Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Issue with Get companies API

(0) ShareShare
ReportReport
Posted on by 26
am trying to integrate Salesforce with Business central. I am totally new to business central and learend hot to hit BC API.
So created application in Azure AD, and in BC have configured Azure Active Directory Application Card also and gave full permision also
 
 
//

and when I tried to get the get companies with the API https:/api.businesscentral.dynamics.com/v2.0/XXXXXXXXXXXXXXXX/Production/api/v1.0/companies

I am getting only below response in postman and not sure why other companies are not coming.

//

  • Community member Profile Picture
    Community member 26 on at
    Issue with Get companies API
    Hi,
     
    By going to the  URL you provided I am seeing there is a different URL for On Prem. From where I can get that please and I got confirmation from client that it is On Prem server only.
     
     
     
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    Issue with Get companies API
    Obviously, what you get in Postman is the Cloud version, so there is only one company. There is nothing wrong with this.
    However, what you need to get is the On-Pre version, which is another environment. It looks like Office 365 authentication is set up.
    In addition, the Endpoint of On-Prem is different from the Cloud version. I hope the following information can give you some tips.
     
    PS:
    How to use Postman to connect to Dynamics 365 Business Central On-Premises
    Business Central Server Administration tool is removed with Business Central 2022 release wave 2
     
     
    Thanks.
    ZHU
  • Community member Profile Picture
    Community member 26 on at
    Issue with Get companies API
    Hi YUN ZHU,
     
    I tried with businesscentral.dynamics.com URL and getting like as below
     
     
    But Original URL given by client is this https://bctest.sheldonmfg.com/
     
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    Issue with Get companies API
    Hi, can you provide a complete screenshot of the page below? This can tell you whether your current environment is the On-Pre version, Tenant ID, Environment Name, Companies and other information.
  • Community member Profile Picture
    Community member 26 on at
    Issue with Get companies API
    Hi YUN ZHU.
     
    I am getting environments like this
     
     
    And in the response I am getting name as Production 
     
    So After that I am passing like this
     
     
    and getting the same response 
     
    {
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/623862c9-25a2-4c00-9b75-3af5811fce9a/Production/api/v2.0/$metadata#companies",
    "value": [
    {
    "id": "2887748d-9c8e-ee11-be3f-6045bde9b4bf",
    "systemVersion": "23.2.14098.14274",
    "timestamp": 4000,
    "name": "CRONUS USA, Inc.",
    "displayName": "",
    "businessProfileId": "",
    "systemCreatedAt": "2023-11-29T09:49:17.563Z",
    "systemCreatedBy": "00000000-0000-0000-0000-000000000001",
    "systemModifiedAt": "2023-11-29T09:49:17.563Z",
    "systemModifiedBy": "00000000-0000-0000-0000-000000000001"
    }
    ]
    }
     
     
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    Issue with Get companies API
    Hi, but the company you get is not in this environment. Please reconfirm whether the environment you access in Endpoint is the same as the one you are opening now.
     
     
    Mainly the following Tenant ID and Environment Name:
     
    Hope this helps.
    Thanks.
    ZHU
  • Community member Profile Picture
    Community member 26 on at
    Issue with Get companies API
    Thanks Yun Zhu for your reply..
     
    I am seeing this in my company list and this is a on Prem server I feel
     
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    Issue with Get companies API
    It's indeed a bit strange. Is the environment access wrong?
    Or does more than one company not exist in that environment?
  • Community member Profile Picture
    Community member 26 on at
    Issue with Get companies API
    Hi Yun Zu,
     
    I tried that also but still I am not able to get companies. I am struggling with this for the past few days and not able to figure out also
     
  • YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    Issue with Get companies API
    Hi, looks like a permissions issue, please remove the Company below.
    For example,
     
    Hope this helps.
    Thanks.
    ZHU

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans