---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# UriMatcherResponse :スコープ指定

# UriMatcherResponse :スコープ指定 {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：9分

URI が、スキーム、ホスト、パス、フラグメント、およびクエリパラメーターの存在に関して指定された基準と一致するかどうかに関する情報を返すメソッドを提供します。

この API を UriMatcher API とともに使用します。この API にはコンストラクターがありません。代わりに、 [UriMatcher - match()](https://servicenow-prod.fluidtopics.net/c22~6zuaJk2NQjEhBQZeag#UriMatcher-match_S_S_O_O_O_B "URI が、スキーム、ホスト、パス、フラグメント、およびクエリパラメーターの存在に関して指定された基準と一致するかどうかを確認します。") メソッドを使用して UriMatcherResponse オブジェクトをインスタンス化します。

UriMatcherResponse API には、デフォルトでアクティブになっている REST API プロバイダー (com.glide.rest) プラグインが必要です。

この API は、 `sn_ws` 名前空間内で提供されます。

## UriMatcherResponse:getErrorMessages() {#ariaid-title2}

指定された基準で URI をテストしたときに発生したエラーに関するメッセージを返します。
{#UriMatcherResp-getErrorMessages__table_ymw_1zt_rdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 1. パラメーター]

{#UriMatcherResp-getErrorMessages__table_ymw_1zt_rdc} {#UriMatcherResp-getErrorMessages__table_zmw_1zt_rdc__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | 発生したエラーの説明。エラーが発生しなかった場合は、空の文字列が返されます。 |
[表 : 2. 返される内容]

{#UriMatcherResp-getErrorMessages__table_zmw_1zt_rdc}  
この例では、ホストが一致基準で指定されなかったため、エラーが返されます。

    var uri = "https://example.com";
    var scheme = "https";    
    var matcher = new sn_ws.UriMatcher();  
    var resp = matcher.match(uri, scheme);  

    gs.info("Error occurred: " + resp.isError());  
    gs.info("Error message: " + resp.getErrorMessages());

出力：

    Error occurred: true
    Error message: Hosts rule is null or empty.

## UriMatcherResponse:isError() {#ariaid-title3}

指定された基準に照らして URI をテストしたときにエラーが発生したかどうかを確認します。
{#UriMatcherResp-isError__table_mh3_xyt_rdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 3. パラメーター]

{#UriMatcherResp-isError__table_mh3_xyt_rdc} {#UriMatcherResp-isError__table_nh3_xyt_rdc__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | エラーが発生したかどうかを示すフラグ。 有効な値： * true:エラーが発生しました。 * false:エラーは発生しませんでした。 {#UriMatcherResp-isError__ul_wxh_2t4_sdc} |
[表 : 4. 返される内容]

{#UriMatcherResp-isError__table_nh3_xyt_rdc}  
この例では、URI にクエリーパラメーターが含まれているため、エラーが返されます。このエラーは、disallowQueryParametersの match() に渡された引数が `true` であるために発生します。

    var uri = "https://example.com/path1/more?q=query";
    var scheme = "https";  
    var allowedHosts = ["example.com", "sample.com"];  
    var allowedPaths = ["/path1/more", "/path2/less"];  
    var allowedFragments = ["section1", "section2"];  
    var noQueryParams = true;
    var matcher = new sn_ws.UriMatcher();  
    var resp = matcher.match(uri, scheme, allowedHosts, allowedPaths, allowedFragments, noQueryParams);  

    gs.info("Error occurred: " + resp.isError());  
    gs.info("Error message: " + resp.getErrorMessages());

出力：

    Error occurred: true
    Error message: Query parameters are not allowed for matching.

## UriMatcherResponse:isFragmentMatches() {#ariaid-title4}

URI がフラグメントのクライテリアに一致するかどうかを確認します。
{#UriMatcherResp-isFragmentMatches__table_vls_lzt_rdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 5. パラメーター]

{#UriMatcherResp-isFragmentMatches__table_vls_lzt_rdc} {#UriMatcherResp-isFragmentMatches__table_wls_lzt_rdc__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | URI がフラグメントの基準と一致するかどうかを示すフラグ。 有効な値： * true:URI はフラグメントの基準と一致します。 * false:URI がフラグメントの基準と一致しません。 {#UriMatcherResp-isFragmentMatches__ul_mgr_ckp_sdc} |
[表 : 6. 返される内容]

{#UriMatcherResp-isFragmentMatches__table_wls_lzt_rdc}  
この例は、許可されたフラグメントのリストにないフラグメントが含まれているため、URI が基準と一致しないことを示しています。

    var uri = "https://example.com/path1/more#section3";
    var scheme = "https";  
    var allowedHosts = ["example.com", "sample.com"];  
    var allowedPaths = ["/path1/more", "/path2/less"];  
    var allowedFragments = ["section1", "section2"];  
    var matcher = new sn_ws.UriMatcher();  
    var resp = matcher.match(uri, scheme, allowedHosts, allowedPaths, allowedFragments);  

    gs.info("Is URI a match: " + resp.isMatch());  
    gs.info("Is scheme a match: " + resp.isSchemeMatches());  
    gs.info("Is host a match: " + resp.isHostMatches());  
    gs.info("Is path a match: " + resp.isPathMatches());  
    gs.info("Is fragment a match: " + resp.isFragmentMatches());
    gs.info("Error occurred: " + resp.isError());

出力：

    Is URI a match: false
    Is scheme a match: true
    Is host a match: true
    Is path a match: true
    Is fragment a match: false
    Error occurred: false

## UriMatcherResponse:isHostMatches() {#ariaid-title5}

URI がホストの基準と一致するかどうかを確認します。
{#UriMatcherResp-isHostMatches__table_igl_hzt_rdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 7. パラメーター]

{#UriMatcherResp-isHostMatches__table_igl_hzt_rdc} {#UriMatcherResp-isHostMatches__table_jgl_hzt_rdc__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | URI がホストの基準と一致するかどうかを示すフラグ。 有効な値： * true:URI はホストの基準と一致します。 * false:URI がホストの基準と一致しません。 {#UriMatcherResp-isHostMatches__ul_dks_slp_sdc} |
[表 : 8. 返される内容]

{#UriMatcherResp-isHostMatches__table_jgl_hzt_rdc}  
この例では、URI が指定されたスキームとホストと一致するかどうかを確認します。

    var uri = "https://example.com/path?q=query";
    var scheme = "https";  
    var allowedHosts = ["example.com"];  
    var matcher = new sn_ws.UriMatcher();  
    var resp = matcher.match(uri, scheme, allowedHosts);  

    gs.info("Is URI a match: " + resp.isMatch());
    gs.info("Is host a match: " + resp.isHostMatches());

出力：

    Is URI a match: true
    Is host a match: true

## UriMatcherResponse:isMatch() {#ariaid-title6}

URI が指定されたすべての基準に一致するかどうかを確認します。
{#UriMatcherResp-isMatch__table_gzs_tyt_rdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 9. パラメーター]

{#UriMatcherResp-isMatch__table_gzs_tyt_rdc} {#UriMatcherResp-isMatch__table_hzs_tyt_rdc__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | URI が指定されたすべての基準に一致するかどうかを示すフラグ。 有効な値： * true:URI はすべての条件に一致します。 * false:URI はすべての基準と一致しません。 {#UriMatcherResp-isMatch__ul_dks_slp_sdc} |
[表 : 10. 返される内容]

{#UriMatcherResp-isMatch__table_hzs_tyt_rdc}  
この例では、URI が指定されたスキームとホストと一致するかどうかを確認します。

    var uri = "https://example.com/path?q=query";
    var scheme = "https";  
    var allowedHosts = ["example.com"];  
    var matcher = new sn_ws.UriMatcher();  
    var resp = matcher.match(uri, scheme, allowedHosts);  

    gs.info("Is URI a match: " + resp.isMatch());

出力：

    Is URI a match: true

## UriMatcherResponse:isPathMatches() {#ariaid-title7}

URI がパスの基準と一致するかどうかを確認します。
{#UriMatcherResp-isPathMatches__table_a5x_3zt_rdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 11. パラメーター]

{#UriMatcherResp-isPathMatches__table_a5x_3zt_rdc} {#UriMatcherResp-isPathMatches__table_b5x_3zt_rdc__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | URI がパスの基準と一致するかどうかを示すフラグ。 有効な値： * true:URI はパスの基準と一致します。 * false:URI がパスの基準と一致しません。 {#UriMatcherResp-isPathMatches__ul_dks_slp_sdc} |
[表 : 12. 返される内容]

{#UriMatcherResp-isPathMatches__table_b5x_3zt_rdc}  
この例では、URI が指定されたスキーム、ホスト、およびパスと一致するかどうかを確認します。

    var uri = "https://example.com/path1/more";
    var scheme = "https";  
    var allowedHosts = ["example.com", "sample.com"];  
    var allowedPaths = ["/path1/more", "/path2/less"];  
    var matcher = new sn_ws.UriMatcher();  
    var resp = matcher.match(uri, scheme, allowedHosts, allowedPaths);  

    gs.info("Is URI a match: " + resp.isMatch());  
    gs.info("Is scheme a match: " + resp.isSchemeMatches());  
    gs.info("Is host a match: " + resp.isHostMatches());  
    gs.info("Is path a match: " + resp.isPathMatches());  
    gs.info("Is fragment a match: " + resp.isFragmentMatches());
    gs.info("Error occurred: " + resp.isError());

出力：

    Is URI a match: true
    Is scheme a match: true
    Is host a match: true
    Is path a match: true
    Is fragment a match: true
    Error occurred: false

## UriMatcherResponse:isSchemeMatches() {#ariaid-title8}

URI がスキームの基準と一致するかどうかを確認します。
{#UriMatcherResp-isSchemeMatches__table_p54_dzt_rdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 13. パラメーター]

{#UriMatcherResp-isSchemeMatches__table_p54_dzt_rdc} {#UriMatcherResp-isSchemeMatches__table_q54_dzt_rdc__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | URI がスキームの基準と一致するかどうかを示すフラグ。 有効な値： * true:URI はスキームの基準と一致します。 * false:URI がスキームの基準と一致しません。 {#UriMatcherResp-isSchemeMatches__ul_dks_slp_sdc} |
[表 : 14. 返される内容]

{#UriMatcherResp-isSchemeMatches__table_q54_dzt_rdc}  
この例では、URI が指定されたスキームとホストと一致するかどうかを確認します。

    var uri = "https://example.com/path?q=query";
    var scheme = "https";  
    var allowedHosts = ["example.com"];  
    var matcher = new sn_ws.UriMatcher();  
    var resp = matcher.match(uri, scheme, allowedHosts);  

    gs.info("Is URI a match: " + resp.isMatch());
    gs.info("Is scheme a match: " + resp.isSchemeMatches());

出力：

    Is URI a match: true
    Is scheme a match: true


