Skip To Content

Create service

  • URL: https://<notebookserveradmin>/services/createService(POST only)
  • Required Capability: Create and edit ArcGIS Notebooks and Publish web tools
  • Version Introduced:10.9.1

Description

ArcGIS Notebook Server supports publishing a geoprocessing service from a notebook. The createService operation creates a service when a JSON representation of the service is submitted to it.

To publish a service on Notebook Server, you must be an administrator or a user with Notebook and Publish Web Tools privileges. The notebook must belong to the user publishing the service.

A snapshot of the notebook is automatically created and used for the web tool. If any changes are made to the notebook after publishing a web tool, you must overwrite the web tool for the change to be reflected.

A notebook-to-web tool relationship is created to maintain the relationship between the notebook and the associated web tool created for the service. This relationship ensures that ownership and sharing permissions are the same for both. When a notebook is deleted, the associated web tool is also deleted.

Request parameters

ParameterDetails
serviceProperties

The JSON representation of the service being created.

Example

{
  "description": "Description of web tool",
  "provider": "notebooks",
  "type": "GPServer",
  "jsonProperties": {
    "title": "A title for web tool.",
    "notebookId": "notebookItemId",
    "tasks": [
      {
        "type": "notebook",
        "name": "task_name"
      }
    ]
  }
}
f

The response format. The default response format is html.

Values: html | json | pjson

Example usage

https://notebookservermachine.domain.com/webadaptor/admin/services/createService  
serviceProperties = {
  "description": "This is a sample web tool description",
  "provider": "notebooks",
  "type": "GPServer",
  "jsonProperties": {
    "title": "WebToolItemTitle",
    "notebookId": "9fd15e228e7b4110a86c12a8245b24f2",
    "tasks": [
      {
        "type": "notebook",
        "name": "webtoolinputtest"
      }
    ],
    "snapshotId": "execute-notebook-snapshot-5925445a5c86445ca1e409465e890ee7.json"
  }
}

JSON Response syntax


{ 
  "itemId": "itemId number", 
  "status": "success" 
}

JSON Response example

The following is a sample response for the createService operation and includes the itemId value for the web tool:

{ 
  "itemId": "5599ee6266414c3ba051fc6db9e7b993", 
  "status": "success" 
}

JSON Response example

The following error response is returned when an attempt is made to create a service with a notebook owned by another user:

{ 
  "error": { 
    "code": 500, 
    "message": "Unable to publish a web tool. To create a web tool from a notebook, the user must own the notebook item.", 
    "details": null 
  } 
}