Skip to content

Commit e4a667f

Browse files
authored
[Power Pages] Fix GCC, High and DoD endpoints for PP API (#1226)
fix: update API endpoints for various service scopes - 🔧 Updated PPAPI_MOONCAKE_WEBSITES_SERVICE_SCOPE_DEFAULT to use the correct URL. - 🔧 Added new endpoints for GCC and HIGH service scopes. - 🔧 Updated DOD service scope endpoint to the correct URL. -Priyanshu
1 parent a68a9bd commit e4a667f

File tree

4 files changed

+52
-10
lines changed

4 files changed

+52
-10
lines changed

src/client/test/Integration/power-pages/services/PPAPIServices.test.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ describe('PPAPIService', () => {
3333
creator: 'Mock User',
3434
createdOn: '2025-01-01T00:00:00Z',
3535
siteVisibility: undefined,
36-
isCodeSite: false
36+
isCodeSite: false,
37+
languageCode: "1033"
3738
};
3839

3940
const mockWebsiteDetailsArray: IWebsiteDetails[] = [mockWebsiteDetails];
@@ -238,7 +239,40 @@ describe('PPAPIService', () => {
238239
);
239240

240241
// Verify result contains the correct base URL for GCC
241-
expect(endpoint).to.include('https://api.powerplatform.us');
242+
expect(endpoint).to.include('https://api.gov.powerplatform.microsoft.us');
243+
});
244+
245+
it('should return endpoint for HIGH environment', async () => {
246+
// Call the function
247+
const endpoint = await PPAPIService.getPPAPIServiceEndpoint(
248+
ServiceEndpointCategory.HIGH,
249+
mockEnvironmentId
250+
);
251+
252+
// Verify result contains the correct base URL for HIGH
253+
expect(endpoint).to.include('https://api.high.powerplatform.microsoft.us');
254+
});
255+
256+
it('should return endpoint for DOD environment', async () => {
257+
// Call the function
258+
const endpoint = await PPAPIService.getPPAPIServiceEndpoint(
259+
ServiceEndpointCategory.DOD,
260+
mockEnvironmentId
261+
);
262+
263+
// Verify result contains the correct base URL for DOD
264+
expect(endpoint).to.include('https://api.appsplatform.us');
265+
});
266+
267+
it('should return endpoint for MOONCAKE environment', async () => {
268+
// Call the function
269+
const endpoint = await PPAPIService.getPPAPIServiceEndpoint(
270+
ServiceEndpointCategory.MOONCAKE,
271+
mockEnvironmentId
272+
);
273+
274+
// Verify result contains the correct base URL for MOONCAKE
275+
expect(endpoint).to.include('https://api.powerplatform.partner.microsoftonline.cn');
242276
});
243277

244278
it('should log telemetry for unsupported region', async () => {

src/common/services/AuthenticationProvider.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import { ERROR_CONSTANTS } from "../ErrorConstants";
2525
import {
2626
BAP_SERVICE_SCOPE_DEFAULT,
2727
INTELLIGENCE_SCOPE_DEFAULT,
28-
PPAPI_GCC_HIGH_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT,
28+
PPAPI_GCC_WEBSITES_SERVICE_SCOPE_DEFAULT,
29+
PPAPI_HIGH_WEBSITES_SERVICE_SCOPE_DEFAULT,
30+
PPAPI_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT,
2931
PPAPI_MOONCAKE_WEBSITES_SERVICE_SCOPE_DEFAULT,
3032
PPAPI_PREPROD_WEBSITES_SERVICE_SCOPE_DEFAULT,
3133
PPAPI_TEST_WEBSITES_SERVICE_SCOPE_DEFAULT,
@@ -47,9 +49,9 @@ const serviceScopeMapping: { [key in ServiceEndpointCategory]: string } = {
4749
[ServiceEndpointCategory.PREPROD]: PPAPI_PREPROD_WEBSITES_SERVICE_SCOPE_DEFAULT,
4850
[ServiceEndpointCategory.TEST]: PPAPI_TEST_WEBSITES_SERVICE_SCOPE_DEFAULT,
4951
[ServiceEndpointCategory.MOONCAKE]: PPAPI_MOONCAKE_WEBSITES_SERVICE_SCOPE_DEFAULT,
50-
[ServiceEndpointCategory.GCC]: PPAPI_GCC_HIGH_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT,
51-
[ServiceEndpointCategory.DOD]: PPAPI_GCC_HIGH_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT,
52-
[ServiceEndpointCategory.HIGH]: PPAPI_GCC_HIGH_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT,
52+
[ServiceEndpointCategory.GCC]: PPAPI_GCC_WEBSITES_SERVICE_SCOPE_DEFAULT,
53+
[ServiceEndpointCategory.HIGH]: PPAPI_HIGH_WEBSITES_SERVICE_SCOPE_DEFAULT,
54+
[ServiceEndpointCategory.DOD]: PPAPI_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT
5355
};
5456

5557
export function getCommonHeadersForDataverse(

src/common/services/Constants.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ export const PPAPI_WEBSITES_API_VERSION = '2022-03-01-preview';
2424
export const PPAPI_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.powerplatform.com/.default";
2525
export const PPAPI_PREPROD_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.preprod.powerplatform.com/.default";
2626
export const PPAPI_TEST_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.test.powerplatform.com/.default";
27-
export const PPAPI_MOONCAKE_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.powerplatform.cn/.default";
28-
export const PPAPI_GCC_HIGH_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.powerplatform.us/.default";
27+
export const PPAPI_MOONCAKE_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.powerplatform.partner.microsoftonline.cn/.default";
28+
export const PPAPI_GCC_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.gov.powerplatform.microsoft.us/.default";
29+
export const PPAPI_HIGH_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.high.powerplatform.microsoft.us/.default";
30+
export const PPAPI_DOD_WEBSITES_SERVICE_SCOPE_DEFAULT = "https://api.appsplatform.us/.default";
2931
export const PPAPI_WEBSITES_ENDPOINT = `{rootURL}/powerpages/environments/{environmentId}/websites`;
3032

3133
export enum ServiceEndpointCategory {

src/common/services/PPAPIService.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,16 @@ export class PPAPIService {
9191
ppApiEndpoint = "https://api.powerplatform.com";
9292
break;
9393
case ServiceEndpointCategory.DOD:
94+
ppApiEndpoint = "https://api.appsplatform.us";
95+
break;
9496
case ServiceEndpointCategory.GCC:
97+
ppApiEndpoint = "https://api.gov.powerplatform.microsoft.us";
98+
break;
9599
case ServiceEndpointCategory.HIGH:
96-
ppApiEndpoint = "https://api.powerplatform.us";
100+
ppApiEndpoint = "https://api.high.powerplatform.microsoft.us";
97101
break;
98102
case ServiceEndpointCategory.MOONCAKE:
99-
ppApiEndpoint = "https://api.powerplatform.cn";
103+
ppApiEndpoint = "https://api.powerplatform.partner.microsoftonline.cn";
100104
break;
101105
default:
102106
sendTelemetryEvent({ eventName: VSCODE_EXTENSION_GET_PPAPI_WEBSITES_ENDPOINT_UNSUPPORTED_REGION, data: serviceEndpointStamp });

0 commit comments

Comments
 (0)