How to use the @esri/arcgis-rest-portal.determineOwner function in @esri/arcgis-rest-portal

To help you get started, we’ve selected a few @esri/arcgis-rest-portal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / arcgis-rest-js / packages / arcgis-rest-service-admin / src / create.ts View on Github external
export function createFeatureService(
  requestOptions: ICreateServiceOptions
): Promise {
  const owner = determineOwner(requestOptions);
  const baseUrl = `${getPortalUrl(requestOptions)}/content/users/${owner}`;
  const url = `${baseUrl}/createService`;
  const options: ICreateServiceOptions = {
    ...requestOptions,
    rawResponse: false
  };

  // Create the service
  options.params = {
    createParameters: options.item,
    outputType: "featureService",
    ...options.params
  };

  if (!options.folderId || options.folderId === "/") {
    // If the service is destined for the root folder, just send the request