Continuous Integration/Continuous Delivery (CICD) API
The CICD API provides endpoints that enable integration with common DevOps tools for building pipelines. These tools include Jenkins, Azure Pipelines, GitLab, GitHub Actions, Atlassian Bamboo/Pipelines, and more.
It provides integrators with the ability to build CICD pipelines for ServiceNow AI Platform applications driven by pull/merge request workflows typical in source-driven development. It leverages the Source Control, Application Repository, and Automated Test Framework features.
The CI/CD API provides the following product and feature areas:
- Source control
Apply remote changes for an application linked to a remote Git repository through the Source Control feature in Studio, on a specific instance.
Imports an application using the specified repository URL and branch name.
- Application repository: Available for scoped applications, global application,
application customizations for scoped applications on the ServiceNow Store, and
through plugins.
- Publish an application from an instance to the connected application repository.
- Install an application onto an instance from the connected application repository.
- Rollback an application that was installed through rollback context.
- Batch
- Define a JSON manifest file to batch install multiple applications together.
- Rollback the entire batch install through rollback context.
- Returns the results of a batch install based on a specified result identifier.
- Plugins
- Activate a plugin.
- Rollback a plugin through rollback context.
- Automated Test Framework (ATF)
- Start an ATF test suite.
- Obtain the pass/fail result of an ATF test suite.
- Instance scan
- Start an instance scan (full, point scan on table, point scan on record, scoped application, update set, combination of these items.)
- Obtain the pass/fail result of an instance scan run.
- Progress
Obtain the percentage completion on an instance for processes initiated by other endpoint calls. You can use this feature to poll until progress completion before proceeding with the next step.
Pending, along with a unique identifier and link. Use this information to
obtain additional information about the progress, source, results, and/or findings of the
request. Depending on the function request, you can use one of the following means to obtain
additional information about a request:- Call the /sn_cicd/progress/{progress_id} endpoint using the links.progress.id parameter returned by the initiating endpoint.
- Call the /sn_cicd/testsuite/results/{result_id} endpoint using the links.result.id parameter returned by the initiating endpoint.
- Call the /sn_cicd/instance_scan/result/{progress_id} endpoint using the links.progress.id parameter returned by the initiating endpoint.
- Call the /sn_cicd/sc/apply_stash/{stash_id} endpoint using the links.stash.id parameter returned by the/sn_cicd/progress/{progress_id} endpoint.
- Link out to the links.<progress/result/source/findings>.url parameter returned by the initiating endpoint.
The sn_cicd.sys_ci_automation or admin role is required to use this API.
Beginning in Tokyo, the CICD API endpoints that need to obtain the instance wide lock / mutex to perform their requested operation will use a queue, rather than rejecting requests while the instance wide lock / mutex is occupied. Multiple CICD pipelines simultaneously make requests without detecting the rejection and retrying, and instead, can simply monitor the progress as they would for successful requests previously. This behavior is on by default.
- Continuous Integration and Continuous Delivery (CICD) Spoke
- https://plugins.jenkins.io/servicenow-cicd/
- https://marketplace.visualstudio.com/items?itemName=ServiceNow.vss-services-servicenow-cicd
- https://github.com/marketplace?type=actions&query=servicenow
- https://hub.docker.com/r/servicenowdevx/sncicd-gitlab-docker
CI/CD - GET /sn_cicd/app/batch/results/{result_id}
Returns the results of a batch install based on a specified result identifier.
Call this method after calling the /sn_cicd/app/batch/install endpoint to obtain the results of the batch install. Use the value returned in the links.results.id parameter of the return results of /sn_cicd/app/batch/install endpoint as the result_id for this endpoint. You can also call the /api/sn_cicd/progress/{progress_id} endpoint to obtain information on the progress of the installation if it has not yet completed.
URL format
Versioned URL: /api/sn_cicd/{api_version}/app/batch/results/{result_id}
Default URL: /api/sn_cicd/app/batch/results/{result_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| result_id | Sys_id of the batch installation for which to return results information. This
value is returned in the links.results.id parameter of the
/sn_cicd/app/batch/install endpoint. Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| batch_items | JSON array, where each object provides details of a package
installation. Data type: Array |
| batch_items.customization_version | Only applicable when the batch_items.type parameter is set
to application or plugin and the
requested_customization_version parameter is passed in the
batch install request. Version of the store application or scoped ServiceNow plugin customization package to install, such as
1.0.2 or 2.3. Data type: String |
| batch_items.id | Sys_id of the application or identifier of the plugin to install. Same as the
packages.id parameter in the initiating
/sn_cicd/app/batch/install endpoint call. Data type: String |
| batch_items.install_date | Date and time that the package was installed. Empty if the request is still in
progress. Data type: String |
| batch_items.name | Name of the package. Data type: String |
| batch_items.notes | User specified notes about the package. Same as the
packages.notes parameter in the initiating
/sn_cicd/app/batch/install endpoint call. Data type: String |
| batch_items.state | Current state of the associated package installation. Possible values:
Data type: String |
| batch_items.status_message | Describes any errors that occurred during the installation of the package
and/or customizations. Data type: String |
| batch_items.type | Type of application. Same as the packages.type parameter
in the initiating /sn_cicd/app/batch/install endpoint
call. Valid values:
Data type: String |
| batch_items.url | URL of the associated package installation record on your ServiceNow instance. Data type: String |
| batch_items.version | Version of the package to install, such as 1.0.2 or 2.3. Same as the
packages.requested_version parameter in the initiating
/sn_cicd/app/batch/install endpoint call. Data type: String |
| batch_plan | Describes the installation batch plan. Data type: Object |
| batch_plan.id | Sys_id of the return results information. Same value as what was passed in the
result_id request parameter. Data type: String |
| batch_plan.name | User specified descriptive name for this batch request. Same as the
name parameter in the initiating
/sn_cicd/app/batch/install endpoint call. Data type: String |
| batch_plan.notes | Notes that were passed in when the batch install was invoked. Same as the
notes parameter in the initiating
/sn_cicd/app/batch/install endpoint call. Data type: String |
| batch_plan.state | Current state of the overall batch installation. Possible values:
Data type: String |
| batch_plan.url | URL of the batch installation plan record on your ServiceNow instance. Data type: String |
cURL request
This example checks the status of a batch installation plan called Release 2.0 IT Operations.
curl 'instance.servicenow.com/api/sn_cicd/app/batch/results/df24b1e9db2d0110b5e3f6c5ae97c561 \
--request GET \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"batch_plan": {
"name":“Release 2.0 IT Operations”,
"id": "df24b1e9db2d0110b5e3f6c5ae97c561",
"url": "https://instance.service-now.com/sys_batch_install_plan.do?sys_id=df24b1e9db2d0110b5e3f6c5ae97c561",
"state": "Installed",
"notes": "User specified notes for batch install plan",
}
"batch_items": [
{
"name": "com.sn_cicd_spoke",
"type": "Application",
"version": "7.0.0",
"state": "Installed",
"install_date": "2020-08-31 15:30:01",
"id": "c159b1e9db1c0010b5e3f6c5ae961903",
"url":"https://instance.service-now.com/sys_batch_install_item.do?sys_id=c159b1e9db1c0010b5e3f6c5ae961903",
"notes" : ""
},
{
"name": "Customization for CSM App1",
"type": "Application",
"version": "1.0.0",
"state": "Installed",
"install_date": "2020-08-31 15:32:01",
"id": "e824b1e9db2d1001b5e3f6c5ae97d628",
"url": "https://instance.service-now.com/sys_batch_install_item.do?sys_id=e824b1e9db2d1001b5e3f6c5ae97d628",
"notes": "Customized headers.",
"customization_version": "2.1.1”,
"status_message": ""
}]
}
}
CI/CD - GET /sn_cicd/instance_scan/result/{progress_id}
Returns the current progress and status of the CI/CD instance scan function associated with a passed-in progress ID. Call this method after calling one of the other instance scan CI/CD endpoints such as /sn_cicd/instance_scan/full_scan or /sn_cicd/instance_scan/point_scan.
sn_cicd namespace.URL format
Versioned URL: /api/sn_cicd/{api_version}/instance_scan/result/{progress_id}
Default URL: /api/sn_cicd/instance_scan/result/{progress_id}
Supported request parameters
| Parameter | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| progress_id | Unique identifier of the function for which to return progress information.
This value is returned in the links.progress.id parameter of
the endpoint that initiated the action, such as
/sn_cicd/instance_scan/full_scan or
/sn_cicd/instance_scan/point_scan. Data type: String |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Request body
The API accepts these JSON or XML elements in the request body.
| Element | Description |
|---|---|
| None |
Response body
The API returns these JSON or XML elements in the response body.
| Element | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.findings | Object that contains information about the instance scan findings. |
| links.findings.label | Additional information about the instance scan findings. |
| links.findings.url | URL to use to retrieve a list of records that violated the checks. |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Unique identifier of the progress detail. |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| links.results | ID and URL of the execution results. Data type: Object |
| links.results.id | Sys_id of the instance scan results record. |
| links.results.url | URL to use to obtain the results of the instance scan. |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional information about why the operation failed. Returns an empty string if the operation is successful. Data type: String |
Sample cURL request
curl 'instance.service-now.com/api/sn_cicd/instance_scan/result/a74c70a11b7800103d374087bc4bcb28' \
--request GET \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"findings": {
"url": "https://instance.service-now.com/api/now/table/scan_finding?sysparm_query%3Dresult%3D6f4cf8651b7800103d374087bc4bcb41%5EORDERBYsys_id",
"label": "First 10,000 findings"
},
"progress": {
"id": "a74c70a11b7800103d374087bc4bcb28",
"url": "https://instance.service-now.com/api/sn_cicd/progress/a74c70a11b7800103d374087bc4bcb28"
},
"results": {
"id": "a74c70a11b7800103d374087bc4bcb28",
"url": "https://instance.service-now.com/api/sn_cicd/instance_scan/result/a74c70a11b7800103d374087bc4bcb28"
}
},
"status": "2",
"status_label": "Successful",
"status_message": "",
"status_detail": "",
"error": ""
}
}
CI/CD - GET /sn_cicd/progress/{progress_id}
Returns the current progress and status of the Continuous Integration and Continuous Delivery (CICD) function associated with a specified progress ID.
Call this method after calling one of the asynchronous CICD endpoints such as /sn_cicd/app_repo/publish, /sn_cicd/app_repo/install, /sn_cicd/testsuite/run, or /sn_cicd/sc/apply_stash.
URL format
Versioned URL: /api/sn_cicd/{api_version}/progress/{progress_id}
Default URL: /api/sn_cicd/progress/{progress_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| progress_id | Unique identifier of the function for which to return progress information. This value is returned in the links.progress.id parameter of the endpoint that initiated the action, such as /sn_cicd/app_repo/publish, /sn_cicd/app_repo/install, /sn_cicd/testsuite/run, or /sn_cicd/sc/apply_stash. Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| links.results | ID and URL of the execution results. Data type: Object |
| links.results.id | Sys_id of the results information. Use this value when calling the associated results endpoint. Data type: String |
| links.results.url | URL to use to obtain the results of the endpoint execution. Data type: String |
| links.source | Sys_id and URL information about the source record in the Execution Tracker [sys_execution_tracker] table. Data type: Object |
| links.source.id | Unique identifier of the source record. Table: Execution Tracker [sys_execution_tracker] table Data type: String |
| links.source.url | URL to use to obtain the source information in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| links.stash | If a was created during an apply_changes operation, this object contains information about the stash.
This object is not returned if a stash wasn’t created. Data type: Object |
| links.stash.id | Unique identifier of the created stash. Use this value when calling the CI/CD - POST /sn_cicd/sc/apply_stash/{stash_id} endpoint to apply the stash. Data type: String |
| links.stash.url | URL of the associated stash. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
Obtain the progress of a test suite run
curl 'instance.servicenow.com/api/sn_cicd/progress/a4fae8911bdc00103d374087bc4bcbbd' \
--request GET \
--header 'Accept: application/json' \
--user 'username':'password'
Progress of the apply changes call.
{
"result": {
"links": {
"progress": {
"id": "a4fae8911bdc00103d374087bc4bcbbd",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/a4fae8911bdc00103d374087bc4bcbbd"
},
"source": {
"id": "59c4c4d11b5c00103d374087bc4bcb26",
"url": "https://instance.servicenow.com/api/now/table/sys_app/59c4c4d11b5c00103d374087bc4bcb26"
}
},
"status": "2",
"status_label": "Successful",
"status_message": "This operation succeeded",
"status_detail": "Successfully applied commit 1f14e11a7dedcbfa194beb5875fcdaa15ed8accb from source control",
"error": "",
"percent_complete": 100
}
}
Obtain the progress of an apply changes call. In this case, there were unsaved/uncommitted changes on the instance in Studio, so a stash was created to hold the unsaved changes
curl 'instance.servicenow.com/api/sn_cicd/progress/a4fae8911bdc00103d374087bc4bcbbd' \
--request GET \
--header 'Accept: application/json' \
--user 'username':'password'
Progress providing information on the created stash.
{
"result": {
"links": {
"progress": {
"id": "5b12eca4e0429110f8771827f8fd36a4",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/5b12eca4e0429110f8771827f8fd36a4"
},
"stash": {
"id": "fc2224e4e0429110f8771827f8fd3634",
"url": "https://instance.servicenow.com/api/sn_cicd/sc/apply_stash/fc2224e4e0429110f8771827f8fd3634"
}
},
"status": "2",
"status_label": "Successful",
"status_message": "This operation succeeded",
"status_detail": "Successfully applied commit fa5626f6f1f7fef677c16b4a0dd8b22ba8a6e311 from source control",
"error": "",
"percent_complete": 100
}
}
cURL request
curl 'instance.servicenow.com/api/sn_cicd/progress/5b12eca4e0429110f8771827f8fd36a4' \
--request GET \
--header 'Accept: application/json' \
--user 'username':'password'
Progress of a test suite run (/sn_cicd/testsuite/run).
{
"result": {
"links": {
"progress": {
"id": "e891389d1b1040103d374087bc4bcb75",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/e891389d1b1040103d374087bc4bcb75"
},
"results": {
"id": "2891389d1b1040103d374087bc4bcb09",
"url": "https://instance.servicenow.com/api/sn_cicd/testsuite/results/2891389d1b1040103d374087bc4bcb09"
}
},
"status": "2",
"status_label": "Successful",
"status_message": "Suite passed",
"status_detail": "Suite passed",
"error": "",
"percent_complete": 100
}
}
CI/CD - GET /sn_cicd/testsuite/results/{result_id}
Returns the results of a test suite run based on a specified results identifier.
Call this endpoint after calling /sn_cicd/progress/{progress_id} to obtain the result of the executed test suite.
URL format
Versioned URL: /api/sn_cicd/{api_version}/testsuite/results/{result_id}
Default URL: /api/sn_cicd/testsuite/results/{result_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| result_id | Unique identifier of the test suite results to retrieve. The corresponding
/sn_cicd/progress/{progress_id} endpoint call returns this
information. Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| child_suite_results | Results of nested test suites. The format of this content is the same as the parent test. |
| error | Error message. Data type: String |
| links | Object that contains all links and sys_ids associated with the
response. Data type: Object |
| links.results | Object that contains the results information. Data type: Object |
| links.results.id | Unique identifier of the results information. Use
this value when calling the endpoint
/sn_cicd/testsuite/results/{result_id}. Data type: String |
| links.results.url | URL to use to obtain the results of the endpoint
execution, such as results. Data type: String |
| percent_complete | Percentage of the request that is complete. |
| rolledup_test_error_count | Number of tests with errors. Data type: Number |
| rolledup_test_failure_count | Number of tests that failed. Data type: Number |
| rolledup_test_skip_count | Number of tests that were skipped. Data type: Number |
| rolledup_test_success_count | Number of tests that ran successfully. Data type: Number |
| status | Numeric execution state. Used with
status_label, such as 0: Pending. Values:
Data type: String |
| status_detail | Additional information about the current state. Data type: String |
| status_label | Execution state description. Used with
status, such as 0: Pending. Values:
Data type: String |
| status_message | Description of the current state. Data type: String |
| test_suite_duration | Amount of time that it took to execute the test suite. Unit: Seconds Data type: String |
| test_suite_name | Name of the test suite. Data type: String |
| test_suite_status | State of the test suite. Data type: String |
cURL request
curl 'instance.servicenow.com/api/sn_cicd/testsuite/results/2891389d1b1040103d374087bc4bcb09' \
--request GET \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"results": {
"id": "2891389d1b1040103d374087bc4bcb09",
"url": "https://instance.servicenow.com/sys_atf_test_suite_result.do?sys_id=2891389d1b1040103d374087bc4bcb09"
}
},
"status": "2",
"status_label": "Successful",
"status_message": "",
"status_detail": "",
"error": "",
"test_suite_status": "success",
"test_suite_duration": "1 Second",
"rolledup_test_success_count": 1,
"rolledup_test_failure_count": 0,
"rolledup_test_error_count": 0,
"rolledup_test_skip_count": 0,
"test_suite_name": "Quick Test",
"child_suite_results": []
}
}
CI/CD - POST /sn_cicd/app/batch/install
Installs two or more packages in a single specified batch.
- Application:
- Scoped applications in the ServiceNow Store that are not owned by your company
- Scoped or global applications in the application repository that are owned by your company
- Your application customizations for Store applications in the application repository
- ServiceNow plugin:
Application customizations for scoped applications that were packaged in a plugin and were published to the application repository.
URL format
Versioned URL: /api/sn_cicd/{api_version}/app/batch/install
Default URL: /api/sn_cicd/app/batch/install
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| name | Required. User specified descriptive name for this batch request. Data type: String |
| notes | User specified additional notes about the batch install plan. Data type: String Default: Null |
| packages | Required. JSON array, where each object specifies details of a package to
install. Data type: Array |
| packages.id | Required. Sys_id of the application or identifier of the plugin to
install. Data type: String |
| packages.load_demo_data | Flag that indicates whether demo data is loaded when installing the
package. Valid values:
Data type: Boolean Default: false |
| packages.notes | User specified notes about the package. Data type: String Default: Null |
| packages.requested_customization_version | Version of the application customization to the store application or to the
scoped ServiceNow plugin to install, such as 1.0.2 or 2.3.
Data type: String Default: None. If this parameter is not set, then the system does not look for customizations for the application. |
| packages.requested_version | Required if packages.type is set to
application; ignored if set to plugin. Version
of the package to install, such as 1.0.2 or 2.3. Data type: String |
| packages.type | Required. Type of package. Valid values:
Data type: String |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 405 | Invalid method. The functionality is disabled. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | All links and sys_ids associated with the response. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| links.results | Describes the results link information. Data type: Object |
| links.results.id | Sys_id of the results of the batch endpoint call. Use this value when calling
the endpoint specified in links.results.url to query the batch
install results. Data type: String |
| links.results.url | URL to use to retrieve the results of the batch install. Data type: String |
| links.rollback | Describes the batch install rollback information. Data type: Object |
| links.rollback.id | Sys_id of the rollback details for the installed packages. Use this parameter
to rollback the installation of the specified packages to their previous versions
using the /sn_cicd/app/batch/rollback/{rollback_id} endpoint. Note: The rollback capability is only available after the installation is
complete. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
This example initiates a batch installation called Release 2.2 Deployment that contains three packages (one of each type) to install.
curl 'instance.servicenow.com/api/sn_cicd/app/batch/install \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password' \
--data { "name": "Release 2.2 Deployment",
"packages": [
{
"id": "syd_id_abcefghi",
"type": "application",
"load_demo_data": false,
"requested_version": "1.0.2",
"notes": "User specific text to describe this application install"
},
{
"id": "syd_id_defabcde",
"type": "application",
"requested_version": "1.0.0",
"requested_customization_version": "2.0.7",
"notes": "Customization for CSM App1"
},
{
"id": "com.glide.some.plugin",
"type": "plugin",
"load_demo_data": true,
"notes": "Plugin related notes"
}]
}
{
"result": {
"links": {
"progress": {
"id": "c159b1e9db1c0010b5e3f6c5ae961903",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/c159b1e9db1c0010b5e3f6c5ae961903"
},
"results": {
"id": "df24b1e9db2d0110b5e3f6c5ae97c561",
"url": "https://instance.servicenow.com/api/sn_cicd/app/batch/results/df24b1e9db2d0110b5e3f6c5ae97c561"
},
"rollback":{
"id": "a329f82e871da64c724ba21c82a764f2"
},
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/app/batch/rollback/{rollback_id}
Rolls back all of the packages associated with a specific batch installation to their previous versions.
This endpoint works in conjunction with the /sn_cicd/app/batch/install endpoint. The rollback_id is provided in the return results of this endpoint. When this endpoint is called, it rolls back all packages specified in the associated install; you cannot rollback individual packages. If there is no previous version, the endpoint uninstalls the associated package.
URL format
Versioned URL: /api/sn_cicd/{api_version}/app/batch/rollback/{rollback_id}
Default URL: /api/sn_cicd/app/batch/rollback/{rollback_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| rollback_id | Sys_id of the batch installation plan for which to rollback the installed
packages to their previous versions. This value is returned in the
links.rollback.id parameter of the
/sn_cicd/app/batch/install endpoint. Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | All links and sys_ids associated with the response. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
This example rolls back all the packages within the specified installation batch plan to their previous version.
curl 'instance.servicenow.com/api/sn_cicd/app/batch/rollback/a329f82e871da64c724ba21c82a764f2 \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "c159b1e9db1c0010b5e3f6c5ae961903",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/c159b1e9db1c0010b5e3f6c5ae961903"
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/app_repo/install
Installs the specified application from the application repository onto the instance making the endpoint call.
Using this endpoint you are able to install both unaltered and customized ServiceNow base system and ServiceNow Store applications, customized ServiceNow plugins, and your own ServiceNow applications.
The following outlines the parameters that you need to pass to implement specific use cases. All parameters that are not specified are not passed in and use the associated defaults.
- To only install the base application and not the corresponding application
customizations.
- sys_id: Sys_id of the base application that has been customized.
- base_app_version: Version of the base application to install.
- To install a specified version of application customizations and automatically install
the recommended base application version. The recommended base application version is
the version of the base application that was installed on the instance at the time that
the customizations were last published. Every version of application customizations has
a corresponding recommended base application version.
- sys_id: Sys_id of the application that has been customized.
- auto_upgrade_base_app: true
- version: Version of the application customizations to install.
- To install the latest version of the application customizations and its corresponding
recommended base application version.
- sys_id: Sys_id of the application that has been customized.
- auto_upgrade_base_app: true
- To install the latest version of the application customizations, but not upgrade the
base application to the application customizations recommended base application
version.
- sys_id: Sys_id of the application that has been customized.
- auto_upgrade_base_app: false
- To install application customizations along with the scoped ServiceNow plugin of the current release.
- scope: Scope of the plugin that has been customized OR
- sys_id: Sys_id of the application that has been customized. This is not the ID of the plugin.
- version: Version of the application customizations to install.
- To install application customizations for an already installed and activated scoped
plugin.
- sys_id: Sys_id of the application that has been customized. This is not the ID of the plugin.
- auto_upgrade_base_app: false
- version: Version of the application customizations to install.
Since base plugins can have only one version per family release, the auto_upgrade_base_app and base_app_version parameters don't apply to application customization installs for plugins. To activate a plugin for the first time on an instance, use the /sn_cicd/plugin/{plugin_id}/activate endpoint instead.
URL format
Versioned URL: /api/sn_cicd/{api_version}/app_repo/install
Default URL: /api/sn_cicd/app_repo/install
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| Name | Description |
|---|---|
| auto_upgrade_base_app | Only applicable if you intend to install application customizations and the base application was built on a version that is later than the currently installed version. Flag that indicates whether the associated base application should be automatically upgraded to a later version. Valid values:
Data type: Boolean Default: false |
| base_app_version | Version of the base application to install. A base application is any third-party application that is available in theServiceNow Store. If the application has no application customizations, or if the application has application customizations and you are only updating the base application, then enter the updated version of the application in this parameter. If you are updating application customizations, don't pass this parameter, but rather pass the version parameter. Data type: String Default: Null |
| scope | Required if sys_id is not specified. Scope name of the application, such as x_aah_custom_app. Data type: String Table: In the scope field in the Custom Application [sys_app] table or Store Application [sys_store_app] table. |
| sys_id | Required if scope is not specified. Sys_id of the application to install. Data type: String Table: In the Sys ID field in the Custom Application [sys_app] table or Store Application [sys_store_app] table. |
| version | Version of the application to install. Data type: String Default: If the base_app_version parameter is empty and the auto_upgrade_base_app parameter is set to true, installs the latest application customizations and its recommended base application version (as long as it doesn't downgrade the base application.) If the auto_upgrade_base_app parameter is false, installs the application customizations, but the base application is not upgraded. If the base_app_version parameter is defined, only installs the base application. |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| rollback_version | If available, the previously installed version. If not available, null. Data type: String |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
curl 'instance.servicenow.com/api/sn_cicd/app_repo/install?sys_id=2d146921dbd80010caf55268dc9619d8' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "c159b1e9db1c0010b5e3f6c5ae961903",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/c159b1e9db1c0010b5e3f6c5ae961903"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0,
"rollback_version": "1.1.0"
}
}
CI/CD - POST /sn_cicd/app_repo/publish
Publishes the specified application and all of its artifacts to the application repository.
URL format
Versioned URL: /api/sn_cicd/{api_version}/app_repo/publish
Default URL: /api/sn_cicd/app_repo/publish
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| Name | Description |
|---|---|
| dev_notes | Developer notes to store with the application. Data type: String |
| scope | Required if sys_id isn’t specified. The scope of the application. Data type: String Table: In the scope field of the Custom Application [sys_app] table. |
| sys_id | Required if scope isn’t specified. The sys_id of the application to store in the repository. Data type: String Table: In the Sys ID field of the Custom Application [sys_app] table. |
| version | Version under which to store the application. If the version number is passed, the publish process uses that version and updates the local application version if different. If the version number isn’t passed, the publish process uses the current version of the local application and fails if that version exists in the application repository. Data type: String |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Request failed. Possible issues:
|
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
The following example shows how to publish the application with the specified sys_id and all of its artifacts to the application repository.
curl 'instance.servicenow.com/api/sn_cicd/app_repo/publish?sys_id=4dd9686d1b9800103d374087bc4bcb3d' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "d174f8e11bd800103d374087bc4bcbd9",
"url": "https://instance.service-now.com/api/sn_cicd/progress/d174f8e11bd800103d374087bc4bcbd9"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/app_repo/rollback
Initiates a rollback of a specified application to a specified version.
URL format
Versioned URL: /api/sn_cicd/{api_version}/app_repo/rollback
Default URL: /api/sn_cicd/app_repo/rollback
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| Name | Description |
|---|---|
| scope | Required if sys_id is not specified. The scope name of the
application to rollback. Data type: String |
| sys_id | Required if scope is not specified. The sys_id of the
application to rollback. Data type: String |
| version | Required. Version of the application that is expected after the rollback
operation. If the request is to rollback an App Customization install, then set this
field to the version of the base application that the system is expected to have
after the rollback operation. Data type: String |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 405 | Invalid method. The functionality is inactive. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
curl 'instance.servicenow.com/api/sn_cicd/app_repo/rollback?sys_id=2d146921dbd80010caf55268dc9619d8&version=1.1.0' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "f7ddb1eddb1c0010b5e3f6c5ae9619c1",
"url": "https://instance.service-now.com/api/sn_cicd/progress/f7ddb1eddb1c0010b5e3f6c5ae9619c1"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/instance_scan/full_scan
Runs all active checks present in your instance.
You can run checks that are provided with Instance Scan or you can create your own checks. For more information, see Instance Scan.
sn_cicd namespace.URL format
Versioned URL: /api/sn_cicd/{api_version}/instance_scan/full_scan
Default URL: /api/sn_cicd/instance_scan/full_scan
Supported request parameters
| Parameter | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Request body
The API accepts these JSON or XML elements in the request body.
| Element | Description |
|---|---|
| None |
Response body
The API returns these JSON or XML elements in the response body.
| Element | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Unique identifier of the progress detail. Use this value when calling the endpoint /sn_cicd/instance_scan/result/{progress_id}. |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional information about why the operation failed. Returns an empty string if the operation is successful. Data type: String |
Sample cURL request
curl 'instance.service-now.com/api/sn_cicd/instance_scan/full_scan' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "a4fae8911bdc00103d374087bc4bcbbd",
"url": "https://instance.service-now/api/sn_cicd/progress/a4fae8911bdc00103d374087bc4bcbbd"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": ""
}
}
CI/CD - POST /sn_cicd/instance_scan/point_scan
Executes all applicable checks against a specified record.
For example, if you execute a point scan against a Catalog Item, only the checks applicable to the Catalog Item table run, and only the specified record is scanned.
You can run checks that are provided with Instance Scan or you can create your own checks. For more information, see Instance Scan.
sn_cicd namespace.URL format
Versioned URL: /api/sn_cicd/{api_version}/instance_scan/point_scan
Default URL: /api/sn_cicd/instance_scan/point_scan
Supported request parameters
| Parameter | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| target_table | Required. Name of the table in which the record to scan resides, such as
"Incident." Data type: String |
| target_sys_id | Required. The sys_id of the record within the specified table to scan. Data type: String |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. Invalid or empty query parameters. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Request body
The API accepts these JSON or XML elements in the request body.
| Element | Description |
|---|---|
| None |
Response body
The API returns these JSON or XML elements in the response body.
| Element | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Unique identifier of the progress detail. Use this value when calling the endpoint /sn_cicd/instance_scan/result/{progress_id}. |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional information about why the operation failed. Returns an empty string if the operation is successful. Data type: String |
Sample cURL request
curl 'instance.service-now.com/api/sn_cicd/instance_scan/point_scan?target_table=incident&target_sys_id=2d146921dbd80010caf55268dc9619d8' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "a4fae8911bdc00103d374087bc4bcbbd",
"url": "https://instance.service-now/api/sn_cicd/progress/a4fae8911bdc00103d374087bc4bcbbd"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": ""
}
}
CI/CD - POST /sn_cicd/instance_scan/suite_scan/combo/{combo_sys_id}
Runs a scan using a suite and target (scoped apps or update sets) that have already run previously.
Before calling this endpoint, you must call the /sn_cicd/instance_scan/suite_scan/{suite_sys_id}/scoped_apps or /sn_cicd/instance_scan/suite_scan/{suite_sys_id}/update_sets endpoints, or execute a suite scan in the UI.
sn_cicd namespace.URL format
Versioned URL: /api/sn_cicd/{api_version}/instance_scan/suite_scan/combo/{combo_sys_id}
Default URL: /api/sn_cicd/instance_scan/suite_scan/combo/{combo_sys_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| combo_sys_id | Sys_id of the scan to run. The scan must be an existing scan that you want to re-run. Data type: String Table: Combo [scan_combo] |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Element | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Unique identifier of the progress detail. Use this value when calling the endpoint /sn_cicd/instance_scan/result/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional information about why the operation failed. Returns an empty string if the operation is successful. Data type: String |
cURL request
curl "https://instance.servicenow.com/api/sn_cicd/instance_scan/suite_scan/combo/245d29cc1bd32010178aed72604bcb4b" \
--request POST \
--header "Accept:application/json" \
--user 'username':'password'
Response body - success.
{
"result": {
"links": {
"progress": {
"id": "c08be5c71b1b2010178aed72604bcb6e",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/c08be5c71b1b2010178aed72604bcb6e"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": ""
}
}
CI/CD - POST /sn_cicd/instance_scan/suite_scan/{suite_sys_id}/scoped_apps
Runs all active checks inside a suite against a list of scoped apps.
sn_cicd namespace.URL format
Versioned URL: /api/sn_cicd/{api_version}/instance_scan/suite_scan/{suite_sys_id}/scoped_apps
Default URL: /api/sn_cicd/instance_scan/suite_scan/{suite_sys_id}/scoped_apps
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| suite_sys_id | Sys_id of the suite to run. Data type: String Table: Suite [scan_check_suite] |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| app_scope_sys_ids | Required. A list of sys_ids of the scoped applications to scan. Can't be an empty array. Data type:
Array Table: Application [sys_scope] |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Content-Type | Data format of the request body. Only supports application/json. |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Element | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Unique identifier of the progress detail. Use this value when calling the endpoint /sn_cicd/instance_scan/result/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional information about why the operation failed. Returns an empty string if the operation is successful. Data type: String |
cURL request
This example runs all active checks inside a suite against one scoped application.
curl "https://instance.servicenow.com/api/sn_cicd/instance_scan/suite_scan/833655cc1b94101046e87733cd4bcb4e/scoped_apps" \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{app_scope_sys_ids: [\"078e8020950f12a215a92e8ad9b346e0\"]}" \
--user 'username':'password'
Response body - success.
{
"result": {
"links": {
"progress": {
"id": "147fc14b1b572010178aed72604bcbca",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/147fc14b1b572010178aed72604bcbca"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": ""
}
}
CI/CD - POST /sn_cicd/instance_scan/suite_scan/{suite_sys_id}/update_sets
Runs all active checks inside a suite against a list of update sets.
sn_cicd namespace.URL format
Versioned URL: /api/sn_cicd/{api_version}/instance_scan/suite_scan/{suite_sys_id}/update_sets
Default URL: /api/sn_cicd/instance_scan/suite_scan/{suite_sys_id}/update_sets
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| suite_sys_id | Sys_id of the suite to run. Data type: String Table: Suite [scan_check_suite] |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| update_set_sys_ids | Required. List of sys_ids of the update sets to scan. Can't be an empty array. Data type: Array Table: Update Set [sys_update_set] |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Content-Type | Data format of the request body. Only supports application/json. |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Element | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Unique identifier of the progress detail. Use this value when calling the endpoint /sn_cicd/instance_scan/result/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional information about why the operation failed. Returns an empty string if the operation is successful. Data type: String |
cURL request
This example runs all active checks inside a suite against one update set.
curl "https://instance.servicenow.com/api/sn_cicd/instance_scan/suite_scan/833655cc1b94101046e87733cd4bcb4e/update_sets" \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{update_set_sys_ids: [\"7abef63c1b572010178aed72604bcbfd\"]}" \
--user 'username':'password'
Response body - success.
{
"result": {
"links": {
"progress": {
"id": "d27511031b972010178aed72604bcb72",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/d27511031b972010178aed72604bcb72"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": ""
}
}
CI/CD - POST /sn_cicd/plugin/{plugin_id}/activate
Activates the specified plugin.
URL format
Versioned URL: /api/sn_cicd/{api_version}/plugin/{plugin_id}/activate
Default URL: /api/sn_cicd/plugin/{plugin_id}/activate
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| plugin_id | Unique identifier of the plugin. You can locate this
identifier on the Plugins page within the card of the desired plugin; identified
with the name "ID". Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| links.results | ID and URL of the execution results. Data type: Object |
| links.results.id | Sys_id of the results information. Use this value when calling the associated results endpoint. Data type: String |
| links.results.url | URL to use to obtain the results of the endpoint execution. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
curl 'instance.servicenow.com/api/sn_cicd/plugin/com.glide.web_service_aggregate/activate' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "5b3f052ddb580010caf55268dc961963",
"url": "https://instance.service-now.com/api/sn_cicd/progress/5b3f052ddb580010caf55268dc961963"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/plugin/{plugin_id}/rollback
Rolls back the specified plugin to the previous installed version. If no prior version has been installed, returns an error.
URL format
Versioned URL: /api/sn_cicd/{api_version}plugin/{plugin_id}/rollback
Default URL: /api/sn_cicd/plugin/{plugin_id}/rollback
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| plugin_id | Unique identifier of the plugin. You can locate this
identifier on the Plugins page within the card of the desired plugin; identified
with the name "ID". Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
curl 'instance.servicenow.com/api/sn_cicd/plugin/com.glide.web_service_aggregate/rollback' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "6185dd61db980010caf55268dc961916",
"url": "https://instance.service-now.com/api/sn_cicd/progress/6185dd61db980010caf55268dc961916"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/sc/apply_changes
Starts applying changes from a remote source control to a specified local application or application-customization.
URL format
Versioned URL: /api/sn_cicd/{api_version}/sc/apply_changes
Default URL: /api/sn_cicd/sc/apply_changes
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| Name | Description |
|---|---|
| auto_upgrade_base_app | Only applicable when changes are applied for app-customization and the latest
commit on the Git repository is built on a version that is later than that of the
base application that is currently installed on the local instance. Flag that
indicates whether the system should auto upgrade the base application to a later
version. Data type: Boolean Default: true |
| branch_name | Name of the branch in the source control system from which to acquire the
application. Data type: String Default: Default branch specified on the source control system. |
| scope | Required if sys_id is not specified. The scope name of the
application for which to apply the changes, such as x_aah_custom_app. You can locate
this value in the scope field in the Custom Application
[sys_app] table or Store Application [sys_store_app] table for the
app-customization. Data type: String |
| sys_id | Required if scope is not specified. The sys_id of the
application for which to apply the changes. You can locate this value in the
Sys ID field in the Custom Application [sys_app] table or
Store Application [sys_store_app] table for the app-customization. Data type: String |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional information about why the operation failed. Returns an empty string if the operation is successful. Data type: String |
cURL request
curl 'https://instance.servicenow.com/api/sn_cicd/sc/apply_changes?app_sys_id=043db024db737300a9a754e4dc961915' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "a4fae8911bdc00103d374087bc4bcbbd",
"url": "https://instance.service-now/api/sn_cicd/progress/a4fae8911bdc00103d374087bc4bcbbd"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/sc/apply_stash/{stash_id}
Starts applying a previously generated "stash" of changes from a remote source control to a specified local application or application-customization.
This endpoint works in conjunction with the POST/api/sn_cicd/sc/apply_changes and CI/CD - GET /sn_cicd/progress/{progress_id} endpoints. When the POST /api/sn_cicd/sc/apply_changes endpoint is called, any unsaved or uncommitted changes in App Engine Studio on the associated instance are saved into the database as a stash.
The way to determine whether a stash was created when the changes were initially applied is to call the GET /sn_cicd/progress/{progress_id} endpoint. If a stash was created, the sys_id (stash_id) and URL of the stash are returned. To apply the stashed changes to the associated application, call this apply_stash endpoint using the stash_id returned by the progress endpoint.
URL format
Versioned URL: /api/sn_cicd/{api_version}/sc/apply_stash/{stash_id}
Default URL: /api/sn_cicd/sc/apply_stash/{stash_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| stash_id | Unique identifier of the stash to apply. This value is returned in the links.stash.id parameter in the corresponding CI/CD - GET /sn_cicd/progress/{progress_id} endpoint call. Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Content-Type | Data format of the
request body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
The following code example shows how to call the apply_stash endpoint for stash_id fc2224e4e0429110f8771827f8fd3634.
curl "https://instance.servicenow.com/api/sn_cicd/sc/apply_stash/fc2224e4e0429110f8771827f8fd3634"\
--request POST \
--header "Accept:application/json" \
--header "Content_Type:application/json" \
--user 'username':'password'
The stash is pending, so not yet applied.
{
"result": {
"links": {
"progress": {
"id": "6b04ec28e0429110f8771827f8fd36a4",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/6b04ec28e0429110f8771827f8fd36a4"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/sc/import
Imports an application using the specified repository URL and branch name.
Use this endpoint to import an application from source control in the calling instance so you can then use Continuous Integration and Continuous Delivery (CICD) endpoints, such as /sn_cicd/sc/apply_changes, to deploy the application to upper environments.
URL format
Versioned URL: /api/sn_cicd/{api_version}/sc/import
Default URL: /api/sn_cicd/sc/import
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| Name | Description |
|---|---|
| auto_upgrade_base_app | Only applicable when the application being imported is an app-customization and
the latest commit on the Git repository is built on a version that is later than
that of the base application that is currently installed on the local instance.
Flag that indicates whether the system should auto-upgrade the base application to a later version. Valid values:
Data type: Boolean Default: True |
| branch_name | Required. Name of the branch in the source control system to import the
application from. Data type: String |
| credential_sys_id | Sys_id of the credentials that have access to the Git repository. Data type: String Default: Sys_id set in the system properties glide.source_control.default_basic_auth_credential_sys_id or glide.source_control.default_ssh_private_key_credential_sys_id, depending on whether the repo_url parameter is an https or ssh repository. By default, this property is empty. |
| mid_server_sys_id | Sys_id of the MID server to use for source control operations for this
application. Data type: String Default: Empty string/NULL |
| repo_url | Required. URL of the Git repository to import the application from. Data type: String |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
The following example shows how to import the application located at
https://code.devsnc.com/some-user/ncRegrApp1.git in the
main_branch.
curl "https://instance.servicenow.com/api/sn_cicd/sc/import?repo_url=https%3A%2F%2Fcode.devsnc.com%2Fsome-user%2FncRegrApp1.git&branch_name=main_branch&credential_sys_id=af9b6d6180feb010f8779c30d4dd6b6b" \
--request POST \
--header "Accept:application/json" \
--user 'admin':'admin'
Returns the progress of the import.
{
"result": {
"links": {
"progress": {
"id": "a18c06ea64f23010f87769cd983d4574",
"url": "https://instance.servicenow.com/api/sn_cicd/progress/a18c06ea64f23010f87769cd983d4574"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
CI/CD - POST /sn_cicd/testsuite/run
Starts a specified automated test suite. The test suite runs on the instance from which the endpoint was called.
URL format
Versioned URL: /api/sn_cicd/{api_version}/testsuite/run
Default URL: /api/sn_cicd/testsuite/run
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| Name | Description |
|---|---|
| browser_name | Name of the browser to use to run the client test. This value must match what
is specified in the scheduled client test runner. For additional information on
scheduled client test runners, see Scheduled Client Test Runners. Data type: String Valid values: (must be all lower-case)
Default: any |
| browser_version | Starting value of the version of the browser specified in
browser_name to use to run the test. For example, if you
enter "9", that would enable all 9.x.x.x versions. This value must match what is
specified in the scheduled client test runner. Data type: String |
| is_performance_run | Optional. Flag that indicates whether to execute the test suite as a performance test (Performance Run). Valid values:
Default: false |
| os_name | Name of the operating system under which to run the test suite. This value must
match what is specified in the scheduled client test runner. Data type: String |
| os_version | Starting value of the version of the operating system under which to run the
test suite. For example, if you enter "8", that would enable all 8.x.x.x versions.
This value must match what is specified in the scheduled client test runner. Data type: String |
| run_in_cloud | Optional. Flag that indicates whether to execute the test suite in Cloud Runner or manually. Valid values:
Default: false |
| test_suite_sys_id | Required if test_suite_name is not specified. The sys_id of the test suite to run. Data type: String Table: Test [sys_atf_test_suite] |
| test_suite_name | Required if test_suite_sys_id is not specified. The name of the test suite to run. Data type: String Table:Test [sys_atf_test_suite] |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 401 | The user credentials are incorrect. |
| 403 | Forbidden. The user isn’t an admin or doesn’t have the sn_cicd.sys_ci_automation role. |
| 404 | Not found. The requested item wasn’t found. |
| 405 | Invalid method. The functionality is inactive. |
| 409 | Conflict. The requested item isn’t unique. |
| 500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Error message with details about the error. Data type: String |
| links | Information about any links and sys_ids associated with the update set. Data type: Object |
| links.progress | Progress information about the operation performed on the update set. Data type: Object |
| links.progress.id | Sys_id containing progress details for the operation. You can use this value when calling the endpoint CI/CD - GET /sn_cicd/progress/{progress_id}. Data type: String |
| links.progress.url | URL to use to retrieve the progress details about the operation performed on the update set. Data type: String |
| links.results | ID and URL of the execution results. Data type: Object |
| links.results.id | Sys_id of the results information. Use this value when calling the associated results endpoint. Data type: String |
| links.results.url | URL to use to obtain the results of the endpoint execution. Data type: String |
| percent_complete | Percentage of the request that is complete. Data type: Number |
| status | Number representing the execution state of the action performed on the update set. Corresponds with the status_label descriptor. Possible values:
Data type: String |
| status_detail | Detailed message about the execution status, if available. Corresponds to the detailed_message field in the Execution Tracker [sys_execution_tracker] table. Data type: String |
| status_label | Execution status of the update set action. Corresponds with the status number. Possible values:
Data type: String |
| status_message | Additional description of the action's current state, if available. Data type: String |
cURL request
curl 'https://instance.servicenow.com/api/sn_cicd/testsuite/run?test_suite_sys_id=632e43900b20220050192f15d6673a7e' \
--request POST \
--header 'Accept: application/json' \
--user 'username':'password'
{
"result": {
"links": {
"progress": {
"id": "0578a8d91bdc00103d374087bc4bcbcc",
"url": "https://instance.service-now.com/api/sn_cicd/progress/0578a8d91bdc00103d374087bc4bcbcc"
}
},
"status": "0",
"status_label": "Pending",
"status_message": "",
"status_detail": "",
"error": "",
"percent_complete": 0
}
}
Failure response:
{
"result": {
"status": "3",
"status_label": "Failed",
"status_message": "",
"status_detail": "",
"error": "Scheduled test/suite execution is disabled. Change the value of property 'sn_atf.schedule.enabled' to true to enable it"
}
}