0

I was reading the documentation and stuck in a problem that I do not know how to get Dynamics resource for acquiring access_token using any API (I know my CRM root service address but I do not want to hard-code this service name in my code base). Could you please provide me with the solution to this problem?

Pavlo Mykhailyshyn
  • 203
  • 1
  • 6
  • 20

2 Answers2

0

You need not to hard code it in code base like showed in documentation sample. But normally we will keep this in web.config or app.config xml file just like any connection string & consume it.

Use connection strings in XRM tooling to connect to Common Data Service for Apps

  • Sorry that I did not mention that I`m looking for REST request to get info about my service name. Can it be also done by using any request to the endpoint? For now I`m using such an API "/api/data/v9.0", but it requires 'access_token' to do that and to acquire 'access_token' you need resource, so how can I retrieve it(resource = service name)? – Pavlo Mykhailyshyn Feb 27 '19 at 09:41
  • @PavloMykhailyshyn I feel like you cannot circumvent that scenario.. in other words chasing the own tail.. I remember the old days of on premise CRM with multi tenants concept - we will do a discovery service call to pull all the orgs & iterate them. you are looking for something like that. – Arun Vinoth-Precog Tech - MVP Feb 27 '19 at 14:48
0

You can use the Online Management API to get a list of all the Dynamics 365 instances in your Office 365 tenant. I believe this is what the Plugin Registration tool does when you check "Display a list of the Organization(s)".

This looks useful:

https://learn.microsoft.com/en-us/dynamics365/customer-engagement/developer/online-management-api/sample-quick-start

The C# sample demonstrates how to authenticate to the Online Management API and then retrieve all Customer Engagement instances from your Office 365 tenant.

Community
  • 1
  • 1
Alex
  • 23,004
  • 4
  • 39
  • 73
  • Which token type should I use to retrieve the information from the request to GET `https://admin.services.crm4.dynamics.com/api/v1.1/instances` – Pavlo Mykhailyshyn Feb 28 '19 at 08:38