スコアカード API
スコアカード API は、パフォーマンス分析インジケーターに関するデータのクエリを可能にするエンドポイントを提供します。クエリパラメーターは、アナリティクスハブでインジケーターにドリルダウンするために使用できる関数と同等です。
スコアカード - GET /now/pa/scorecards
アナリティクスハブ からインジケーターの詳細を取得します。
REST API を介したテーブルへのアクセスは BasicAuth によって制限されています。データへのアクセスを制限するために、テーブルで定義されたアクセス制御リストが適用されます。
パフォーマンスアナリティクス API を使用してクエリを作成するには、pa_viewer ロールも必要です。
ほぼすべてのクエリで、sysparm_uuid パラメーターが使用されます。このパラメーターは、インジケーター sys_id と、それに続くオプションとして追加される sys_id のコロン区切りリストで構成されます。sysparm_uuid は常に最初のパラメーターです。
URL 形式
バージョニングされた URL:/api/now/{api_version}/pa/scorecards
デフォルトの URL:/api/now/pa/scorecards
サポートされている要求パラメーター
| 名前 | 説明 |
|---|---|
| api_version | オプションアクセスするエンドポイントのバージョン。たとえば、v1 や v2。最新以外のエンドポイントバージョンを使用する場合にのみ、この値を指定してください。 データタイプ:文字列 |
| パラメーター | 説明 |
|---|---|
| sysparm_breakdown | ブレークダウンの sys_id。そのブレークダウンの定義に基づいて編成されたチャート情報が返されます。たとえば、優先度ブレークダウンの sys_id を入力すると、優先度の値ごとに個別のタスクチャート情報が返されます ([オープン中のインシデントの数/優先度/ 2 - 高] など)。 データタイプ:文字列 |
| sysparm_breakdown_relation | ブレークダウンの関連付けの sys_id。その関連付けを使用して返されたデータをブレークダウンします。 データタイプ:文字列 |
| sysparm_contains | 名前または説明のカンマ区切りリスト。一致する値を持つインジケーターからのみ結果が返されます。すべてのカンマ区切りリストアイテムが一致する必要があります。一致しない場合、結果は返されません。リストは OR ロジックではなく AND ロジックに従います。 データタイプ:文字列 |
| sysparm_display | 返されるインジケーターのタイプを示すフラグ。 有効な値:
データタイプ:文字列 デフォルト:true |
| sysparm_display_value | 返されるデータ (データベースからの実際の値またはフィールドの表示値) のタイプを決定します。表示値は、データベース内の実際の値と、ユーザーやシステムの設定と環境設定に基づいて操作されます。 表示値を返す場合、返される値はフィールドタイプに依存します。
データタイプ:文字列 有効な値:
デフォルト値:false 注: このパラメーター設定に推奨方法はありません。ただし、表示値を指定すると、データベースから直接読み取られず、その他のフィールドやレコードを参照することがあるため、パフォーマンスに問題が発生する可能性があります。表示値と実際の値の詳細については、「テーブル API FAQ (KB0534905)」を参照してください。 |
| sysparm_elements_filter | 返されるデータに適用される要素フィルターの sys_id。 データタイプ:文字列 |
| sysparm_exclude_reference_link | 参照フィールドに指定された追加情報 (参照リソースに対する URI など) を非表示にするかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_favorites | クエリユーザーのお気に入りであるインジケーターのみを返すかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_from | スコアを返す最も早い日付。この日付以降のスコアのみが返されます。 このパラメーターでは、include_scores が true に設定されている必要があります。 形式:ISO-8601 標準 日付タイプ:文字列 |
| sysparm_include_aggregates | 既に適用済みの集計を含め、インジケーターで可能なすべての集計を返すかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_available_aggregates | 集計が適用されていない場合に、インジケーターで利用可能なすべての集計を返すかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_available_breakdowns | インジケーターで利用可能なすべてのブレークダウンを返すかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_forecast_scores | アナリティクスハブ の予測データを定義する日付と値のペアのアレイを含む forecast_scores 要素を返すかどうかを示すフラグ。 このパラメーターでは、include_scores パラメーターも true に設定されている必要があります。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_realtime | インジケーターのリアルタイムスコアが有効かどうかを示す realtime_enabled 要素と、リアルタイムスコア値を含む realtime_value 要素を返すかどうかを示すフラグ。このパラメーターは、計算式インジケーターではサポートされていません。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_score_notes | スコアに関連付けられたすべてのメモを返すかどうかを示すフラグ。メモが追加されると、ノード要素には、メモのテキスト、著者、タイムスタンプが含まれます。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_scores | アナリティクスハブ で選択された時間範囲全体のインジケータースコアを返すかどうかを示すフラグ。値を指定しない場合、このパラメータのデフォルトは false になり、最新のスコア値のみが返されます。 返されるスコアの日付範囲を制限するには、このパラメーターを from および to と組み合わせます。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_target_color_scheme | 最小値と最大値を含むtarget_color_scheme要素と、 アナリティクスハブ のターゲットカラースキームの各セクションの色を返すかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_include_trendline_scores | アナリティクスハブ のトレンドラインを定義する日付と値のペアのアレイを含む trendline_scores 要素を返すかどうかを示すフラグ。 このパラメーターでは、include_scores パラメーターも true に設定されている必要があります。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_key | キーインジケーターの結果のみを返すかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_limit | 返されるスコアの最大数。 データタイプ:数値 |
| sysparm_page | ページ番号。たとえば、デフォルトの sysparm_per_page 値 (10) を使用してインジケーターを 20 個クエリする場合、インジケーター 11 ~ 20 を取得するには sysparm_page 値に 2 を指定します。 データタイプ:数値 |
| sysparm_per_page | 各クエリが 1 ページで返すことができるインジケーターの最大数。 デフォルト値:10 最大:100 データタイプ:数値 |
| sysparm_sortby | 結果をソートするときに使用する値。 有効な値:
データタイプ:文字列 デフォルト:value |
| sysparm_sortdir | ソートの方向。 有効な値:
データタイプ:文字列 デフォルト:降順 |
| sysparm_step | インジケーターの頻度に基づいてスコアをスキップするための数値。たとえば、日次インジケーターの場合は 3 日ごと、週次インジケーターの場合は 3 週ごとのスコアのみを返すには、値に 3 を指定します。 データタイプ:数値 |
| sysparm_tags | インジケーターグループの sys_id。そのグループのインジケーターが返されます。このパラメーターには sysparm_uuid を使用しないでください。 この API を使用してインジケーターグループの sys_id を取得することはできません。代わりに、インジケーターグループレコードから sys_id を取得します。レコードからの sys_id の取得の詳細については、「一意のレコード識別子 (sys_id)」を参照してください。 データタイプ:文字列 |
| sysparm_target | アナリティクスハブ にターゲットが設定されているインジケーターの結果のみを返すかどうかを示すフラグ。 有効な値:
データタイプ:ブーリアン デフォルト値:false |
| sysparm_to | スコアを返す最も遅い日付。この日付以前のスコアのみが返されます。 このパラメーターでは、include_scores が true に設定されている必要があります。 データタイプ:文字列 形式:ISO-8601 標準 |
| sysparm_uuid | クエリするインジケーター、ブレークダウン、集計、およびドメインを指定するための、sys_id 値のコロン区切りリスト。パラメーターの形式は次のとおりです。 <indicator_sys_id>:<breakdown_sys_id>:<elements_filter_sys_id or element_sys_ids>:<lvl-2 breakdown_sys_id>:<lvl-2 elements_filter_sys_id or element_sys_ids>:<aggregate_sys_id>;<domain_sys_id> パラメーターは、インジケーターレコードの sys_id で始める必要があります。必要に応じて、ブレークダウンの sys_id 値とブレークダウン要素を追加し、ブレークダウンに応じた応答をグループ化して、集計の sys_id を追加し、この集計を適用します。集計とともにブレークダウンを使用することや、片方のみを使用することができます。 注:
インジケーターが [デフォルトの時系列] を使用するように設定されていると、この API が取得するそのインジケーターのすべての値で、選択された集計が使用されます。 データタイプ:文字列 |
| 名前 | 説明 |
|---|---|
| なし |
ヘッダー
次のリクエストや応答ヘッダーは、この HTTP アクションにのみ適用されるか、またはこのアクションに別個の方法で適用されます。REST API で使用される一般的なヘッダーのリストについては、「 サポートされている REST API ヘッダー」を参照してください。
| ヘッダー | 説明 |
|---|---|
| 承認 | 応答本文のデータフォーマット。サポートされるタイプ:application/json または application/xml。 デフォルト: application/json |
| ヘッダー | 説明 |
|---|---|
| なし |
ステータスコード
この HTTP アクションには、次のステータスコードが適用されます。REST API で使用される可能性のあるステータスコードのリストについては、「 REST API HTTP 応答コード」を参照してください。
| ステータスコード | 説明 |
|---|---|
| 200 | 成功。要求が正常に処理されました。 |
| 401 | 権限がありません。ユーザー資格情報が間違っているか、渡されていません。 |
| 500 | 内部サーバーエラー。要求の処理中に予期しないエラーが発生しました。応答に、エラーに関する追加情報が含まれます。 |
応答本文のパラメーター (JSON または XML)
| 名前 | 説明 |
|---|---|
| 要求パラメーターによって異なります。 |
分析ハブのすべてのインジケーターを取得
# Request a list of all indicators that
# are displayed in the アナリティクスハブ,
# including their unique record identifiers.
curl --verbose --user "user:password" \
–-header "Accept:application/json" \
"https://instance.service-now.com/api/now/v1/pa/scorecards"
// The following response is truncated
// to show only the Number of open incidents
// indicator, which is used in the other
// examples on this page.
{
"result" : [
...
{
"change_formatted" : "",
"key" : false,
"value_unit" : "",
"value_formatted" : "",
"period_title" : null,
"gapperc" : null,
"gap" : null,
"target" : null,
"period" : null,
"target_formatted" : "",
"favorite" : false,
"direction_label" : "Minimize",
"uuid" : "fb007202d7130100b96d45a3ce6103b4",
"name" : "Number of open incidents",
"value_color" : "#000000",
"frequency_label" : "Daily",
"change" : null,
"gap_formatted" : "",
"gapperc_formatted" : "",
"value" : null,
"unit" : {
"display_value" : "#",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value" : "17b365e2d7320100ba986f14ce6103ad"
},
"changeperc_formatted" : "",
"direction" : 2,
"frequency" : 10,
"precision" : 0,
"changeperc" : null,
"indicator" : {
"display_value" : "Number of open incidents",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value" : "fb007202d7130100b96d45a3ce6103b4"
},
"description" : "Number of incidents open based on resolved date is empty."
},
...
]
}
インジケーターの詳細を返す
sysparm_uuid パラメーターにインジケーター sys_id 値を指定することで、特定のインジケーターの アナリティクスハブ をクエリできます。
# In this example, you use the sys ID for the
# Number of open incidents indicator,
# which you retrieved in the first example,
# when you got all the indicators in the
# アナリティクスハブ:
# "uuid" : "fb007202d7130100b96d45a3ce6103b4",
# "name" : "Number of open incidents"
curl --verbose --user "user:password" \
--header "Accept:application/json" \
"https://instance.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4"
{
"result" : [
{
"change_formatted" : "",
"key" : false,
"value_unit" : "",
"value_formatted" : "",
"period_title" : null,
"gapperc" : null,
"gap" : null,
"target" : null,
"period" : null,
"target_formatted" : "",
"favorite" : false,
"direction_label" : "Minimize",
"uuid" : "fb007202d7130100b96d45a3ce6103b4",
"name" : "Number of open incidents",
"value_color" : "#000000",
"frequency_label" : "Daily",
"change" : null,
"gap_formatted" : "",
"gapperc_formatted" : "",
"value" : null,
"unit" : {
"display_value" : "#",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value" : "17b365e2d7320100ba986f14ce6103ad"
},
"changeperc_formatted" : "",
"direction" : 2,
"frequency" : 10,
"precision" : 0,
"changeperc" : null,
"indicator" : {
"display_value" : "Number of open incidents",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value" : "fb007202d7130100b96d45a3ce6103b4"
},
"description" : "Number of incidents open based on resolved date is empty."
}
]
}
インジケーターのすべてのブレークダウンと集計を返す
sysparm_include_available_breakdowns および sysparm_include_available_aggregates パラメーターを true に設定することで、インジケーターの利用可能なブレークダウンと集計のリストをクエリします。
curl -v -u "user:password" -H "Accept:application/json" \
"https://instance.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4&sysparm_include_available_breakdowns=true&sysparm_include_available_aggregates=true"
{
"result" : [
{
"key" : false,
"change_formatted" : "",
"aggregates" : [
{
"display_value" : "7d running SUM",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_aggregates/89ea4c11d7001100ba986f14ce6103dc",
"value" : "89ea4c11d7001100ba986f14ce6103dc"
},
{
"display_value" : "28d running SUM",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_aggregates/4dfa4c11d7001100ba986f14ce6103e2",
"value" : "4dfa4c11d7001100ba986f14ce6103e2"
},
{
"display_value" : "30d running SUM",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_aggregates/3e409011d7001100ba986f14ce610319",
"value" : "3e409011d7001100ba986f14ce610319"
},
// Aggregates truncated for brevity
],
"changeperc" : null,
"value_formatted" : "",
"period_title" : null,
"gapperc" : null,
"value_unit" : "",
"target" : null,
"period" : null,
"target_formatted" : "",
"favorite" : false,
"gap" : null,
"direction_label" : "Minimize",
"uuid" : "fb007202d7130100b96d45a3ce6103b4",
"name" : "Number of open incidents",
"value_color" : "#000000",
"frequency_label" : "Daily",
"change" : null,
"gap_formatted" : "",
"gapperc_formatted" : "",
"value" : null,
"unit" : {
"display_value" : "#",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value" : "17b365e2d7320100ba986f14ce6103ad"
},
"breakdowns" : [
{
"display_value" : "Priority",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_breakdowns/0df47e02d7130100b96d45a3ce610399",
"value" : "0df47e02d7130100b96d45a3ce610399"
},
{
"display_value" : "Category",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_breakdowns/1f918835d7231100b96d45a3ce6103fe",
"value" : "1f918835d7231100b96d45a3ce6103fe"
},
{
"display_value" : "Assignment Group",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value" : "baec0752bf130100b96dac808c0739ed"
},
// Information for State and Age indicators truncated
],
"changeperc_formatted" : "",
"frequency" : 10,
"precision" : 0,
"direction" : 2,
"indicator" : {
"display_value" : "Number of open incidents",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value" : "fb007202d7130100b96d45a3ce6103b4"
},
"description" : "Number of incidents open based on resolved date is empty."
}
]
}
インジケータースコアの時系列集計を返す
# Apply the 7d running SUM aggregate returned in
# the previous response to the
# アナリティクスハブ using the
# sysparm_uuid value
# with the sys_id of the aggregate.
curl -v -u "user:password" -H "Accept:application/json" \
"https://instance.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4:89ea4c11d7001100ba986f14ce6103dc"
{
"result" : [
{
"key" : false,
"change_formatted" : "",
"value_unit" : "",
"value_formatted" : "",
"period_title" : null,
"aggregate" : {
"display_value" : "7d running SUM",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_aggregates/89ea4c11d7001100ba986f14ce6103dc",
"value" : "89ea4c11d7001100ba986f14ce6103dc"
},
"gapperc" : null,
"target" : null,
"period" : null,
"target_formatted" : "",
"favorite" : false,
"gap" : null,
"direction_label" : "Minimize",
"uuid" : "fb007202d7130100b96d45a3ce6103b4:89ea4c11d7001100ba986f14ce6103dc",
"name" : "Number of open incidents / 7d running SUM",
"value_color" : "#000000",
"frequency_label" : "Daily",
"change" : null,
"gap_formatted" : "",
"gapperc_formatted" : "",
"value" : null,
"unit" : {
"display_value" : "#",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value" : "17b365e2d7320100ba986f14ce6103ad"
},
"changeperc_formatted" : "",
"direction" : 2,
"frequency" : 10,
"precision" : 0,
"changeperc" : null,
"indicator" : {
"display_value" : "Number of open incidents",
"link" : "https://instance.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value" : "fb007202d7130100b96d45a3ce6103b4"
},
"description" : "Number of incidents open based on resolved date is empty."
}
]
}
ブレークダウンの要素を返す
# To get the scores associated with
# each element of a breakdown and
# the sys_ids of those elements, pass
# the sysparm_breakdown
# parameter with the sys_id of the breakdown.
# In this example, you get the elements of
# the Assignment Group breakdown for the
# Number of open incidents indicator.
# From the previous example, you have the
# sys_id of fb007202d7130100b96d45a3ce6103b4
# for the Number of open incidents indicator and the
# sys_id of baec0752bf130100b96dac808c0739ed
# for the Assignment Group breakdown.
curl -v -u "user:password" -H "Accept:application/json" \
"https://instance.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4&sysparm_breakdown=baec0752bf130100b96dac808c0739ed"
// The response consists of a set of
// indicator objects, each
// containing one element object.
// The element objects each
// contain the name and sys_id of an object.
// Because the information about the indicator
// is the same for each indicator
// object, in this example only the first
// indicator object is given
// in detail.
{
"result":[
{
"indicator": {
"display_value":"Number of open incidents",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value":"fb007202d7130100b96d45a3ce6103b4"
},
"gap_formatted":"",
"benchmarking":false,
"frequency_label":"Daily",
"changeperc_formatted":"0.0%",
"direction_label":"Minimize",
"precision":0,
"breakdown": {
"display_value":"Assignment Group",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value":"baec0752bf130100b96dac808c0739ed"
},
"personal_target":null,
"description":"Number of incidents open based on resolved date is empty.",
"value_color":"#455464",
"uuid":"fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:unmatched",
"frequency":10,
"gap":null,
"value_unit":"14",
"indicator_frequency":10,
"value":14.0,
"indicator_aggregate":1,
"facts_table": {
"name":"incident",
"label":"Incidents"
},
"key":false,
"indicator_frequency_label":"Daily",
"direction":2,
"element": {
"display_value":"Unassigned", //Element name
"link":"https://<instance>.service-now.com/api/now/v1/table/sys_user_group/unmatched",
"value":"unmatched" //No sys_id for unmatched scores
},
"period_title":"Jul 22",
"period":"Jul 22",
"target_formatted":"",
"change":0.0,
"gapperc_formatted":"",
"query":"opened_atONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^ORopened_at<javascript:gs.beginningOfToday()^resolved_atISEMPTY^ORresolved_at>javascript:gs.endOfToday()^state!=8",
"realtime_enabled":true,
"changeperc":0.0,
"target":null,
"unit": {
"display_value":"#",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"type":"formatted",
"value":"17b365e2d7320100ba986f14ce6103ad"
},
"value_formatted":"14", // Score where Assignment Group=Unassigned
"name":"Number of open incidents > Assignment Group = Unassigned",
"gapperc":null,
"change_formatted":"0",
"favorite":false,
"personal_target_formatted":""
},
{"indicator": {
"element": {
"display_value":"Software",
"link":"https://<instance>.service-now.com/api/now/v1/table/sys_user_group/8a4dde73c6112278017a6a4baf547aa7",
"value":"8a4dde73c6112278017a6a4baf547aa7" // sys_id of element Software
},
...
"value_formatted":"6", // Score where Assignment Group: Software
"name":"Number of open incidents > Assignment Group = Software",
"gapperc":null,
"change_formatted":"0",
"favorite":false,
"personal_target_formatted":""
},
{"indicator": {
...
"element": {
"display_value":"Service Desk",
"link":"https://<instance>.service-now.com/api/now/v1/table/sys_user_group/d625dccec0a8016700a222a0f7900d06",
"value":"d625dccec0a8016700a222a0f7900d06" // sys_id of element Service Desk
},
...
"value_formatted":"5", // Score for Assignment Group: Service Desk
"name":"Number of open incidents > Assignment Group = Service Desk",
"gapperc":null,
"change_formatted":"0",
"favorite":false,
"personal_target_formatted":""
},
{"indicator": {
...
"element": {
"display_value":"Hardware",
"link":"https://<instance>.service-now.com/api/now/v1/table/sys_user_group/8a5055c9c61122780043563ef53438e3",
"value":"8a5055c9c61122780043563ef53438e3" // sys_id for element Hardware
},
...
"value_formatted":"3", // Score for Assignment Group: Hardware
"name":"Number of open incidents > Assignment Group = Hardware",
"gapperc":null,
"change_formatted":"0",
"favorite":false,
"personal_target_formatted":""
},
{"indicator": {
...
"element": {
"display_value":"Network",
"link":"https://<instance>.service-now.com/api/now/v1/table/sys_user_group/287ebd7da9fe198100f92cc8d1d2154e",
"value":"287ebd7da9fe198100f92cc8d1d2154e"}, // sys_id for element Network
...
"value_formatted":"3", // Score for Assignment Group: Network
"name":"Number of open incidents > Assignment Group = Network",
"gapperc":null,
"change_formatted":"0",
"favorite":false,
"personal_target_formatted":""
},
...
]
...
}
ブレークダウンと要素でフィルタリングされたインジケーターを返す
# The GET request gets the details for
# the indicator Number of open
# incidents, where the Priority of the
# incident is 1 - Critical. The sys_id
# values for the indicator, the
# Priority breakdown, and the 1 -
# Critical element are all passed in
# the sysparm_uuid parameter.
curl --verbose --user "username":"password" \
--header "Accept:application/json" \
"https://instance.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4:0df47e02d7130100b96d45a3ce610399:e5900140200331007665978299a805f3"
{
// The request is made Dec 12. The
// score is 76, which is unchanged from
// Dec 11, and which exceeds the
// target of 70.
"result": [
{
"indicator": {
"display_value":"Number of open incidents",
"link":"https://instance.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value":"fb007202d7130100b96d45a3ce6103b4"
},
"gap_formatted":"-6",
"benchmarking":false,
"frequency_label":"Daily",
"changeperc_formatted":"0.0%",
"direction_label":"Minimize",
"precision":0,
"breakdown": {
"display_value":"Priority",
"link":"https://instance.service-now.com/api/now/v1/table/pa_breakdowns/0df47e02d7130100b96d45a3ce610399",
"value":"0df47e02d7130100b96d45a3ce610399"
},
"personal_target":null,
"description":"Number of incidents open based on resolved date is empty.",
"value_color":"#ff8c00",
"uuid":"fb007202d7130100b96d45a3ce6103b4:0df47e02d7130100b96d45a3ce610399:5f012106db5123003ee8f93baf9619bd",
"frequency":10,
"gap":-6.0,
"value_unit":"76",
"indicator_frequency":10,
"value":76.0,
"indicator_aggregate":1,
"facts_table": {
"name":"incident",
"label":"Incidents"
},
"key":false,
"indicator_frequency_label":"Daily",
"direction":2,
"element": {
"display_value":"1 - Critical",
"link":"https://instance.service-now.com/api/now/v1/table/sys_choice/5f012106db5123003ee8f93baf9619bd",
"value":"5f012106db5123003ee8f93baf9619bd"
},
"period_title":"Dec 12",
"period":"Dec 12",
"target_formatted":"70",
"change":0.0,
"gapperc_formatted":"-8.6%",
"query":"opened_atONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^ORopened_at<javascript:gs.beginningOfToday()^resolved_atISEMPTY^ORresolved_at>javascript:gs.endOfToday()^state!=8^priority=1^EQ",
"realtime_enabled":true,
"changeperc":0.0,
"target":70.0,
"unit": {
"display_value":"#",
"link":"https://instance.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"type":"formatted","value":"17b365e2d7320100ba986f14ce6103ad"
},
"value_formatted":"76",
"name":"Number of open incidents > Priority = 1 - Critical",
"gapperc":-0.08571428571428572,
"change_formatted":"0",
"favorite":true,
"personal_target_formatted":""
}
]
}
場所別にブレークダウンしたインジケーターを返す
curl -v -u "user:password" -H "Accept:application/json" \
"https://<instance>.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4&sysparm_breakdown=656d5662eb23310065deac6aa206fee7"
{
"result": [
{
...
"element": {
"display_value": "San Diego",
"link": "https://<instance>.service-now.com/api/now/v1/table/cmn_location/108752c8c611227501d4ab0e392ba97f",
"value": "108752c8c611227501d4ab0e392ba97f",
"longitude": -117.15726,
"latitude": 32.71533
},
...
}
{
...
"element": {
"display_value": "Florida",
"link": "https://<instance>.service-now.com/api/now/v1/table/cmn_location/8e3e85f037d0200044e0bfc8bcbe5d14",
"value": "8e3e85f037d0200044e0bfc8bcbe5d14",
"longitude": -95.71289,
"latitude": 37.09024
},
...
}
]
}
第 1 および第 2 レベルのブレークダウンスコアを返す
複数のブレークダウンを適用するには、複数のブレークダウン sys_id を sysparm_uuid パラメーターに付加します。
# In this example, the data is broken
# down by priority to show priority 1
# incidents, and by category to show
# database incidents.
curl -v -u "user:password" -H "Accept:application/json" \
"https://instance.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4:0df47e02d7130100b96d45a3ce610399:e5900140200331007665978299a805f3:1f918835d7231100b96d45a3ce6103fe:9e418d40200331007665978299a805c1"
{
"result": [
{
"value_formatted": "",
"indicator": {
"display_value": "Number of open incidents",
"link": "http://instance.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value": "fb007202d7130100b96d45a3ce6103b4"
},
"gapperc": null,
"change": null,
"value_color": "#000000",
"direction": 2,
"target_formatted": "",
"frequency": 10,
"changeperc_formatted": "",
"direction_label": "Minimize",
"period_title": null,
"description": "Number of incidents open based on resolved date is empty.",
"name": "Number of open incidents / Priority / 1 - Critical / Category / Database",
"value": null,
"key": false,
"gap_formatted": "",
"element": {
"display_value": "1 - Critical",
"link": "http://instance.service-now.com/api/now/v1/table/sys_choice/e5900140200331007665978299a805f3",
"value": "e5900140200331007665978299a805f3"
},
"precision": 0,
"element_level2": {
"display_value": "Database",
"link": "http://instance.service-now.com/api/now/v1/table/sys_choice/9e418d40200331007665978299a805c1",
"value": "9e418d40200331007665978299a805c1"
},
"breakdown": {
"display_value": "Priority",
"link": "http://instance.service-now.com/api/now/v1/table/pa_breakdowns/0df47e02d7130100b96d45a3ce610399",
"value": "0df47e02d7130100b96d45a3ce610399"
},
"period": null,
"favorite": false,
"change_formatted": "",
"unit": {
"display_value": "#",
"link": "http://instance.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value": "17b365e2d7320100ba986f14ce6103ad"
},
"frequency_label": "Daily",
"breakdown_level2": {
"display_value": "Category",
"link": "http://instance.service-now.com/api/now/v1/table/pa_breakdowns/1f918835d7231100b96d45a3ce6103fe",
"value": "1f918835d7231100b96d45a3ce6103fe"
},
"target": null,
"changeperc": null,
"uuid": "fb007202d7130100b96d45a3ce6103b4:0df47e02d7130100b96d45a3ce610399:e5900140200331007665978299a805f3:1f918835d7231100b96d45a3ce6103fe:9e418d40200331007665978299a805c1",
"gapperc_formatted": "",
"value_unit": "",
"gap": null
}
]
}
第 2 レベルのブレークダウンの日付の範囲のスコアを返す
すべての使用可能な日付の個々のスコアのリストを要求するには、sysparm_include_scores パラメーターを true に設定します。
スコアの日付範囲を指定するには、sysparm_from パラメーターと sysparm_to パラメーターも使用します。
# In this example, the level 1 breakdown and
# element are Assignment Group: Software
# (sys_id baec0752bf130100b96dac808c0739ed
# and 8a4dde73c6112278017a6a4baf547aa7).
# The level 2 breakdown and element are Priority: 1 -
# Critical (sys_id 0df47e02d7130100b96d45a3ce610399
# and e5900140200331007665978299a805f3).
# Only scores on and after 30 November 2018 are returned.
curl -v -u "resttest:resttest" -H "Accept:application/json" \
"https://<instance>.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:8a4dde73c6112278017a6a4baf547aa7:0df47e02d7130100b96d45a3ce610399:e5900140200331007665978299a805f3&sysparm_include_scores=true&sysparm_from=2018-11-30"
{
"result": [
{ "indicator": {
"display_value":"Number of open incidents",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value":"fb007202d7130100b96d45a3ce6103b4"
},
"gap_formatted":"",
"benchmarking":false,
"frequency_label":"Daily",
"scores": [
{ "end_at":"2018-12-04",
"period":"Dec 04",
"value_formatted":"2",
"start_at":"2018-12-04",
"value":2.0
},
...
{ "end_at":"2018-11-30",
"period":"Nov 30",
"value_formatted":"0",
"start_at":"2018-11-30",
"value":0.0
}
],
"changeperc_formatted":"",
"direction_label":"Minimize",
"precision":0,
"breakdown": { //First-level breakdown
"display_value":"Assignment Group",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value":"baec0752bf130100b96dac808c0739ed"
},
"personal_target":null,
"description":"Number of incidents open based on resolved date is empty.",
"value_color":"#455464",
"uuid":"fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:8a4dde73c6112278017a6a4baf547aa7:0df47e02d7130100b96d45a3ce610399:e5900140200331007665978299a805f3",
"frequency":10,
"gap":null,
"value_unit":"2",
"indicator_frequency":10,
"value":2.0,
"indicator_aggregate":1,
"key":false,
"indicator_frequency_label":"Daily",
"direction":2,
"element": { //First-level breakdown element
"display_value":"Software",
"link":"https://<instance>.service-now.com/api/now/v1/table/sys_user_group/8a4dde73c6112278017a6a4baf547aa7",
"value":"8a4dde73c6112278017a6a4baf547aa7"
},
"period_title":"Dec 04",
"period":"Dec 04",
"target_formatted":"",
"change":2.0,
"gapperc_formatted":"",
"realtime_enabled":false,
"changeperc":null,
"target":null,
"unit":{
"display_value":"#",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"type":"formatted",
"value":"17b365e2d7320100ba986f14ce6103ad"
},
"value_formatted":"2", //Second-level breakdown and element
"name":"Number of open incidents > Assignment Group = Software > Priority = e5900140200331007665978299a805f3",
"gapperc":null,
"change_formatted":"2",
"favorite":false,
"breakdown_level2": {
"display_value":"Priority",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_breakdowns/0df47e02d7130100b96d45a3ce610399",
"value":"0df47e02d7130100b96d45a3ce610399"
},
"personal_target_formatted":""
}
]
}
ブレークダウンと要素のブレークダウンの関連付けを返す
インジケーターに関連付けられたすべてのブレークダウンの関連付けの sys_id 値を取得するには、sysparm_include_available_breakdowns パラメーターを使用します。sysparm_uuid パラメーターには、第 1 レベルのブレークダウンの sys_ids と、見つけたい関連付けを持っている要素を含めます。
# In this example, the sysparm_uuid
# parameter includes the sys_id for the
# Assignment Group breakdown and the
# sys_id for the Software element.
# The sys_id of the Assignment Group
# was obtained in the example where all
# breakdowns and aggregates were returned.
# The sys_id of the Software element was
# obtained in the previous example, where
# all the elements of Assignment Group were
# returned. The sys_id of the Assignment
# Group breakdown is
# baec0752bf130100b96dac808c0739ed
# and of the Software element is
# 8a4dde73c6112278017a6a4baf547aa7.
# The breakdown relation is obtained for the
# Number of open incidents indicator,
# whose sys_id is
# fb007202d7130100b96d45a3ce6103b4.
curl -v -u "user:password" -H "Accept:application/json" "https://<instance>.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:8a4dde73c6112278017a6a4baf547aa7&sysparm_include_available_breakdowns=true"
{
"result": [
{
"value_formatted": "37",
"indicator": {
"display_value": "Number of open incidents",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value": "fb007202d7130100b96d45a3ce6103b4"
},
"gapperc": null,
"change": 9.0,
"value_color": "#455464",
"direction": 2,
"target_formatted": "",
"frequency": 10,
"changeperc_formatted": "32.1%",
"direction_label": "Minimize",
"period_title": "Jul 22",
"description": "Number of incidents open based on resolved date is empty.",
"name": "Number of open incidents / Assignment Group / Software",
"value": 37.0,
"key": false,
"gap_formatted": "",
"element": {
"display_value": "Software",
"link": "https://<instance>.service-now.com/api/now/v1/table/sys_user_group/287ee6fea9fe198100ada7950d0b1b73",
"value": "8a4dde73c6112278017a6a4baf547aa7"
},
"precision": 0,
"breakdowns": [
// Information about each breakdown
],
"breakdown_relations": [
{
"display_value": "Child Groups",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_breakdown_relations/301fd511eb23310065deac6aa206fe31",
"value": "301fd511eb23310065deac6aa206fe31"
},
{
"display_value": "Parent Group",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_breakdown_relations/790b6e11eb23310065deac6aa206fe1c",
"value": "790b6e11eb23310065deac6aa206fe1c"
},
{
"display_value": "Sibling Groups",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_breakdown_relations/15e15a12eb233100871aac6aa206fe59",
"value": "15e15a12eb233100871aac6aa206fe59"
}
],
"breakdown": {
"display_value": "Assignment Group",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value": "baec0752bf130100b96dac808c0739ed"
},
"period": "Jul 22",
"favorite": false,
"change_formatted": "9",
"unit": {
"display_value": "#",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value": "17b365e2d7320100ba986f14ce6103ad"
},
"frequency_label": "Daily",
"target": null,
"changeperc": 0.32142857142857145,
"uuid": "fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:8a4dde73c6112278017a6a4baf547aa7",
"gapperc_formatted": "",
"value_unit": "6",
"gap": null
}
]
}
ブレークダウンの関連付けを使用してインジケーターを返す
ブレークダウンの関連付けを使用するには、sysparm_uuid パラメーターにインジケーター、ブレークダウン、および要素の sys_id 値を含め、sysparm_breakdown_relation パラメーターにブレークダウンの関連付けの sys_id を含めます。
# This example returns the
# Sibling Group values for Assignment
# Group: Software from the previous example.
curl -v -u "user:password" -H "Accept:application/json" \
"https://<instance>.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:8a4dde73c6112278017a6a4baf547aa7&sysparm_breakdown_relation=15e15a12eb233100871aac6aa206fe59"
{
"result": [
{
"indicator": {
"gap_formatted":"",
"benchmarking":false,
"frequency_label":"Daily",
"changeperc_formatted":"0.0%",
"direction_label":"Minimize",
"precision":0,
"breakdown": {
"display_value":"Assignment Group",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value":"baec0752bf130100b96dac808c0739ed"
},
"personal_target":null,
"description":"Number of incidents open based on resolved date is empty",
"value_color":"#455464",
"uuid":"fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:0a52d3dcd7011200f2d224837e6103f2",
"frequency":10,
"gap":null,
"value_unit":"0",
"indicator_frequency":10,
"value":0.0,
"indicator_aggregate":1,
"facts_table": {
"name":"incident",
"label":"Incidents"
},
"key":false,
"indicator_frequency_label":"Daily",
"direction":2,
"element": {
"display_value":"Application Development",
"link":"https://<instance>.service-now.com/api/now/v1/table/sys_user_group/0a52d3dcd7011200f2d224837e6103f2",
"value":"0a52d3dcd7011200f2d224837e6103f2"
},
"period_title":"Dec 03",
"period":"Dec 03",
"target_formatted":"",
"change":0.0,
"gapperc_formatted":"",
"query":"opened_atONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^ORopened_at<javascript:gs.beginningOfToday()^resolved_atISEMPTY^ORresolved_at>javascript:gs.endOfToday()^state!=8^assignment_group=0a52d3dcd7011200f2d224837e6103f2^EQ",
"realtime_enabled":true,
"changeperc":0.0,
"target":null,
"unit": {
"display_value":"#",
"link":"https://<instance>.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"type":"formatted",
"value":"17b365e2d7320100ba986f14ce6103ad"
},
"value_formatted":"0",
"name":"Number of open incidents > Assignment Group = Application Development",
"gapperc":null,
"change_formatted":"0",
"favorite":false,
"personal_target_formatted":""
}
// Followed by an indicator object with an element object for every element in the Sibling Group
]
}
ブレークダウンの要素のフィルタリングされたセットを返す
アナリティクスハブデータに要素フィルターを適用するには、パフォーマンスアナリティクス要素フィルターレコードのsys_idで sysparm_elements_filter パラメーターを使用します。
# In this example, the element filter applies
# to the Groups breakdown source, with the
# condition [[Parent][is][Database]].
# The sys_id of this element filter is
# 7b9eb563eb11020065deac6aa206fe11.
# The example gets the elements of the Assignment
# Group breakdown that have the element Database
# as a parent.
curl -v -u "user:password" -H "Accept:application/json" \
"https://<instance>.service-now.com/api/now/v1/pa/scorecards?sysparm_uuid=fb007202d7130100b96d45a3ce6103b4&sysparm_breakdown=baec0752bf130100b96dac808c0739ed&sysparm_elements_filter=7b9eb563eb11020065deac6aa206fe11"
{
"result": [
{
"value_formatted": "37",
"indicator": {
"display_value": "Number of open incidents",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value": "fb007202d7130100b96d45a3ce6103b4"
},
"gapperc": null,
"change": 9.0,
"value_color": "#455464",
"direction": 2,
"target_formatted": "",
"frequency": 10,
"changeperc_formatted": "32.1%",
"direction_label": "Minimize",
"period_title": "Jul 22",
"description": "Number of incidents open based on resolved date is empty.",
"name": "Number of open incidents / Assignment Group / Database",
"value": 37.0,
"key": false,
"gap_formatted": "",
"element": {
"display_value": "Database",
"link": "https://<instance>.service-now.com/api/now/v1/table/sys_user_group/287ee6fea9fe198100ada7950d0b1b73",
"value": "287ee6fea9fe198100ada7950d0b1b73"
},
"precision": 0,
"breakdown": {
"display_value": "Assignment Group",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value": "baec0752bf130100b96dac808c0739ed"
},
"period": "Jul 22",
"favorite": false,
"change_formatted": "9",
"unit": {
"display_value": "#",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value": "17b365e2d7320100ba986f14ce6103ad"
},
"frequency_label": "Daily",
"target": null,
"changeperc": 0.32142857142857145,
"uuid": "fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:287ee6fea9fe198100ada7950d0b1b73",
"gapperc_formatted": "",
"value_unit": "37",
"gap": null
},
{
"value_formatted": "20",
"indicator": {
"display_value": "Number of open incidents",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value": "fb007202d7130100b96d45a3ce6103b4"
},
// Database Atlanta
"gapperc": null,
"change": 4.0,
"value_color": "#455464",
"direction": 2,
"target_formatted": "",
"frequency": 10,
"changeperc_formatted": "25.0%",
"direction_label": "Minimize",
"period_title": "Jul 22",
"description": "Number of incidents open based on resolved date is empty.",
"name": "Number of open incidents / Assignment Group / Database Atlanta",
"value": 20.0,
"key": false,
"gap_formatted": "",
"element": {
"display_value": "Database Atlanta",
"link": "https://<instance>.service-now.com/api/now/v1/table/sys_user_group/db53580b0a0a0a6501aa37c294a2ba6b",
"value": "db53580b0a0a0a6501aa37c294a2ba6b"
},
"precision": 0,
"breakdown": {
"display_value": "Assignment Group",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value": "baec0752bf130100b96dac808c0739ed"
},
"period": "Jul 22",
"favorite": false,
"change_formatted": "4",
"unit": {
"display_value": "#",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value": "17b365e2d7320100ba986f14ce6103ad"
},
"frequency_label": "Daily",
"target": null,
"changeperc": 0.25,
"uuid": "fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:db53580b0a0a0a6501aa37c294a2ba6b",
"gapperc_formatted": "",
"value_unit": "20",
"gap": null
},
{
"value_formatted": "19",
"indicator": {
"display_value": "Number of open incidents",
"link": "https://<instance>.service-now.com/api/now/v1/table/pa_indicators/fb007202d7130100b96d45a3ce6103b4",
"value": "fb007202d7130100b96d45a3ce6103b4"
},
...
// Database San Diego
"gapperc": null,
"change": 0.0,
"value_color": "#455464",
"direction": 2,
"target_formatted": "",
"frequency": 10,
"changeperc_formatted": "0.0%",
"direction_label": "Minimize",
"period_title": "Jul 22",
"description": "Number of incidents open based on resolved date is empty.",
"name": "Number of open incidents / Assignment Group / Database San Diego",
"value": 10.0,
"key": false,
"gap_formatted": "",
"element": {
"display_value": "Database San Diego",
"link": "https://<instance>.service-now.com/api/now/v1/table/sys_user_group/db53a9290a0a0a650091abebccf833c6",
"value": "db53a9290a0a0a650091abebccf833c6"
},
"precision": 0,
"breakdown": {
"display_value": "Assignment Group",
"link": "http://localhost:8080/api/now/v1/table/pa_breakdowns/baec0752bf130100b96dac808c0739ed",
"value": "baec0752bf130100b96dac808c0739ed"
},
"period": "Jul 22",
"favorite": false,
"change_formatted": "0",
"unit": {
"display_value": "#",
"link": "http://<instance>.service-now.com/api/now/v1/table/pa_units/17b365e2d7320100ba986f14ce6103ad",
"value": "17b365e2d7320100ba986f14ce6103ad"
},
"frequency_label": "Daily",
"target": null,
"changeperc": 0.0,
"uuid": "fb007202d7130100b96d45a3ce6103b4:baec0752bf130100b96dac808c0739ed:db53a9290a0a0a650091abebccf833c6",
"gapperc_formatted": "",
"value_unit": "10",
"gap": null
}
]
}