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 :
Microsoft Dynamics CRM (Archived)

How do I know Server API URL to perform CRUD Operations in On Premise version of CRM?

(0) ShareShare
ReportReport
Posted on by

Hi,

There is Server Root URL that I use to perform CRUD operation in CRM usign WebAPI concept. But today I face problem where I was trying to perform select query in On Primise Account(v8.2).

I use this query to perform any type of transactions:

var serverUrl = location.protocol + "//" + location.host;

var req = new XMLHttpRequest();
req.open("GET", serverUrl + "/api/data/v8.0/" + Query, false);


Above way was working fine but today I have found issue while testing in On Primise Account. Above URL didn't work.

Difference I have seen in Settings --> Customize --> Developer Resource

1- On Primise having Organization name and Server Root URL was like: https://internalcrm.abc.net:333/MyOrganization/api/data/v8.2/

    Online doesn't have such Organization name and Server Root URL was like: https://bondltd.api.crm.dynamics.com/api/data/v8.2/

I have tried to use Server Root URL of OnLine. It was working but Server Root URL of On Primise but it didn't give me any data.

Can anybody please suggest me what ServerURL I should pass to perform operation in CRM On Primize?

Please let me know if any one required more information.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Daniel Wikell Profile Picture
    2,360 on at

    Hi

    In javascript, you want to use the client URL function Xrm.Page.context.getClientUrl() to retrieve the actual URL that was used for accessing CRM.

    So you would have var serverUrl = Xrm.Page.context.getClientUrl();

    Do note that from CRM 9.0 and forward, that function has been moved to reside within the global context Xrm.Utility.getGlobalContext

  • Community Member Profile Picture
    on at

    Thanks Daniel,

    I think above solution will work fine in Javascript. Is there any way to get serverUrl in HTML WebResource?

    Please guide.

  • Verified answer
    Daniel Wikell Profile Picture
    2,360 on at

    For now you can still include the ClientGlobalContext to gain access. See the section "ClientGlobalContext.js.aspx" in msdn.microsoft.com/.../gg328541.aspx

  • Community Member Profile Picture
    on at

    Hi Daniel,

    Thank you very much.

    I hope Xrm.Page.context.getClientUrl(); this will also work to access webresource.

    Currently I access webresource same way as I define in question: serverUrl + "/WebResources/name"

    I hope I can access webresource too by your solution.

    Let me know if I need to access webresources different way in On Premises.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans