Skip to main content

PyPI version app

Cherwell API Client

Cherwell API

Getting Started

Installation

If necessary, upgrade pip:

python3 -m pip install --upgrade pip setuptools wheel twine

Install with PyPI:

pip3 install pycherwell --user

Install from source:

git clone https://github.com/greenpau/pycherwell.git
cd pycherwell
pip3 install -r requirements.txt --user
python3 setup.py install --user --record installed_files.txt

If necessary, uninstall pycherwell:

pip3 uninstall pycherwell
cat installed_files.txt | xargs sudo rm -rf

Configuration

LDAP Configuration file: ~/.cherwell/config:

[default]
client_id = "5d4f6f1b-f0de-4442-8791-4582816b04de"
auth_mode = "LDAP"
username = "MYDOMAIN\myappuser"
password = "xxxxxx"
host = "myapp.cherwellondemand.com"
port = "443"
protocol = "https"

LOCAL configuration file: ~/.cherwell/config:

[default]
client_id = "5d4f6f1b-f0de-4442-8791-4582816b04de"
auth_mode = "Internal"
username = "Cherwell\myappuser"
password = "xxxxxx"
host = "myapp.cherwellondemand.com"
port = "443"
protocol = "https"

Testing

The following command checks whether the services is available:

$ cherwell-client --get-service-info --debug

The expected output is:

{
    "service_info": {
        "api_version": "9.3.2",
        "csm_culture": "en-US",
        "csm_version": "9.3.2",
        "system_date_time": "2019-11-18 18:14:42.510452+00:00"
    }
}

Usage Instructions

Business Objects

The following commands fetches business object summaries. It is a reference to the IDs for business objects themselves, their fields, states, etc.

cherwell-client --get-business-object-summaries > business-object-summaries.json
{
    "business_object_summaries": [
        {
            "bus_ob_id": "fe838f7d1a8d4a748940dba7be76995c",
            "display_name": "Incident",
            "first_rec_id_field": "3910bef5813c421a92e4a68eea109a95",
            "group": false,
            "group_summaries": [],
            "lookup": false,
            "major": true,
            "name": "Incident",
            "rec_id_fields": "f5e8c54b647f48ad81e720132624001e",
            "state_field_id": "cb62a991a2cb4fd98cab26c3519b2d92",
            "states": "Pending,Closed,Reopened,New,In Progress,Resolved,Assigned",
            "supporting": false
        }
    ]
}

By default, the tool stores the returned business objects in ~/.cherwell/business_object.json. Subsequent requests return the content of that file, unless the invocation includes --rebase argument.

cherwell-client --get-business-object-summaries --rebase

Incidents

The following command returns incidents owned by "Application Development" team:

cherwell-client --get-incidents --debug --search-condition "Owned By Team:eq:Application Development"

The following command returns CSV list containing incident ID, type and status of all "Pending" items for "Application Development" team:

cherwell-client --get-incidents \
  --search-condition "Status:eq:Pending" \
  --search-condition "Owned By Team:eq:Application Development" \
  --search-field "IncidentID" --search-field "IncidentType" \
  --search-field "Status" --format csv

The following command returns CSV list of unresolved and not closed items for "Application Development" team:

cherwell-client --get-incidents \
  --search-condition "Owned By Team:eq:Application Development" \
  --search-condition "Status:eq:Pending" \
  --search-condition "Status:eq:Assigned" \
  --search-condition "Status:eq:In Progress" \
  --search-condition "Status:eq:New" \
  --search-field "IncidentID" --search-field "IncidentType" --search-field "Status" \
  --search-field "Service" --search-field "Category"  --search-field "Subcategory" \
  --search-field "Customer Display Name" \
  --search-field "Owned By" \
  --search-field "Created Date Time" \
  --search-field "Short Description" \
  --format csv

The following command is a variation of the one above:

cherwell-client --get-incidents \
  --search-condition "Service:eq:Application Support" \
  --search-condition "Status:eq:Pending" \
  --search-condition "Status:eq:Assigned" \
  --search-condition "Status:eq:In Progress" \
  --search-condition "Status:eq:New" \
  --search-field "IncidentID" --search-field "IncidentType" --search-field "Status" \
  --search-field "Service" --search-field "Category"  --search-field "Subcategory" \
  --search-field "Customer Display Name" \
  --search-field "Owned By" \
  --search-field "Owned By Team" \
  --search-field "Created Date Time" \
  --search-field "Short Description" \
  --format csv

Query closed or resolved incidents starting on a specific day, e.g. 5/22/2020:

cherwell-client --get-incidents \
  --search-condition "Service:eq:Application Support" \
  --search-condition "Status:eq:Closed" \
  --search-condition "Status:eq:Resolved" \
  --search-condition "Stat_DateTimeResolved:gt:5/22/2020 4:33 AM" \
  --search-field "IncidentID" --search-field "IncidentType" --search-field "Status" \
  --search-field "Service" --search-field "Category"  --search-field "Subcategory" \
  --search-field "Customer Display Name" \
  --search-field "Owned By" \
  --search-field "Owned By Team" \
  --search-field "Created Date Time" \
  --search-field "Short Description" \
  --format csv

Query closed or resolved incidents in the last 7 days:

cherwell-client --get-incidents \
  --search-condition "Service:eq:Application Support" \
  --search-condition "Status:eq:Closed" \
  --search-condition "Status:eq:Resolved" \
  --search-condition "Stat_DateTimeResolved:gt:7 days ago" \
  --search-field "IncidentID" --search-field "IncidentType" --search-field "Status" \
  --search-field "Service" --search-field "Category"  --search-field "Subcategory" \
  --search-field "Customer Display Name" \
  --search-field "Owned By" \
  --search-field "Owned By Team" \
  --search-field "Created Date Time" \
  --search-field "Short Description" \
  --format csv

The following command returns information about Cherwell Incident 1234567:

cherwell-client --get-incident 1234567 --debug --format yaml

Creation

Create an incident:

cherwell-client --create-incident \
  --create-field "ShortDescription:Review Pull Request #9 in App Repo" \
  --create-field "Priority:3" \
  --create-field "IncidentType:Incident" \
  --create-field "Service:Application Development" \
  --create-field "Category:Code Review" \
  --create-field "Subcategory:Other" \
  --create-as "FullName:eq:Smith, John" \
  --debug

Create a service request:

cherwell-client --create-incident \
  --create-field "ShortDescription:Release app v1.0.0" \
  --create-field "Priority:3" \
  --create-field "IncidentType:Service Request" \
  --create-field "Service:Application Development" \
  --create-field "Category:Release Management" \
  --create-field "Subcategory:Release" \
  --create-as "FullName:eq:Smith, John" \
  --debug

The expected output is:

{
    "bus_ob_public_id": "293126",
    "bus_ob_rec_id": "362965e244b242c5a3ba5a2b320baaa54632acf12b",
    "cache_key": null,
    "error_code": null,
    "error_message": null,
    "field_validation_errors": [],
    "has_error": false,
    "notification_triggers": []
}

Teams

Get the list of teams:

cherwell-client --get-teams --format text

People

Get user information:

cherwell-client --get-requestors --search-condition "FullName:eq:Smith, John"
cherwell-client --get-requestors --search-condition "FirstName:eq:John" --search-condition "LastName:eq:Smith"

Journal

The following command outputs journal entries for incident 1234567:

cherwell-client --get-journal --incident-id 1234567 --format text

Additionally, journal entries could be filtered:

cherwell-client --get-journal --incident-id 1234567 --format text \
  --search-condition "Journal Type Name:eq:Journal - Note" \
  --search-condition "Journal Type Name:eq:Journal - Customer Request" \
  --search-condition "Journal Type Name:eq:Journal - History" \
  --search-condition "Created Date Time:gt:7 days ago"

Metadata

Release files for pycherwell 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycherwell 1.0.9
File Size Uploaded Provenance Actions
pycherwell-1.0.9.tar.gz 157.3 kB Without provenance Details for pycherwell-1.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pycherwell 1.0.9
File Interpreter ABI Platform Actions
pycherwell-1.0.9-py3-none-any.whl Python 3 none any Details for pycherwell-1.0.9-py3-none-any.whl

Total release size: 500.3 kB

Release files / pycherwell-1.0.9.tar.gz

Download URL pycherwell-1.0.9.tar.gz
Size 157.3 kB
Tags Source
SHA-256 checksum
How to use checksums
69d4f50295a736820f75b635d366eea57714ad4ed7a7c435ddf0bc18aa42b8cc
BLAKE2b-256 checksum
How to use checksums
d7ec5dd6ff2166534552af0f8b2a2cb0fa46651fa65b496d3d7e7b683a796ec9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8

Release files / pycherwell-1.0.9-py3-none-any.whl

Download URL pycherwell-1.0.9-py3-none-any.whl
Size 342.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90ff63a47ed5db16809c04a265b86a231e3605d6cc4340b0a0073799cf9d66ae
BLAKE2b-256 checksum
How to use checksums
4aaff2299b03efe13659d8cf02f7b2969fb0a6b1a94e9aa02650cd7b8227c526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8

Security for pycherwell 1.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.9 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page