규칙 목록 검색

규칙은 규칙 세트를 사용하여 그룹화됩니다. 규칙은 규칙 세트가 없거나 여러 개일 수 있습니다. GET 요청을 사용하여 API [Geographical URI]/api/rule를 호출하여 사용 가능한 모든 규칙, 규칙 세트의 규칙 또는 규칙 세트 목록을 얻습니다. 이 API를 호출할 때 몇 가지 변형이 있지만 가장 일반적인 사용법은 특정 규칙 세트에 대한 규칙 목록을 검색하는 것입니다.

참고

이 API에는 OAuth 토큰이 필요합니다.

헤더

입력 Type 예상 값 필수 여부
Accept-Language string 언어 코드(예: en-US)입니다. 기본값은 en-US입니다. 아니요

매개 변수

입력 Type 예상 값 필수 여부
ruleset string 규칙 세트의 이름 또는 ID 또는 규칙 세트 ID 목록 또는 쉼표 또는 세미콜론으로 구분된 이름(예: "솔루션 검사기")입니다. 아니요
includeMessageFormats bool true로 설정하면 가능한 메시지 변형 목록이 사용 가능한 경우 언어 요청 결과에 포함됩니다. 이 목록은 여러 언어로 번역할 때 유용합니다. 필요하지 않은 경우 이 매개 변수를 제공하지 않거나 값을 false로 제공합니다. 이 매개 변수는 응답 크기를 증가시키고 처리 시간을 늘릴 수 있습니다. 아니요

예상 응답

HTTP 상태 코드 시나리오 Result
200 하나 이상의 결과가 발견되었습니다 이 문서 뒷부분의 예제를 참조하세요. 하나 이상의 결과가 반환될 수 있습니다.
204 결과가 없습니다. 응답 본문에 결과가 없습니다.
401 인증 실패 응답 본문에 결과가 없습니다.

예상 응답 본문

다음 표는 각 요청에 대한 응답 구조를 요약한 것입니다(HTTP 200 응답만).

속성 Type 예상 값 필수 여부
코드 string 규칙의 식별자로, 규칙 ID라고도 합니다. 네
요약 string 규칙의 요약입니다. 네
description string 규칙에 대한 자세한 설명입니다. 네
guidanceUrl URI 게시된 지침을 찾을 수 있는 URL입니다. 전용 지원 지침 문서가 없는 경우가 있을 수 있습니다. 네
포함 boolean 규칙이 분석에 포함되도록 서비스에 알립니다. 이 API의 경우 이 값은 true입니다. 아니요
messageTemplates 배열 이 속성 값은 includeMessageFormats이 true인 경우에만 포함됩니다. 아니요
messageTemplates.ruleId string code 속성과 동일한 ID 값을 반환합니다. 네
messageTemplates.messageTemplateId string 규칙에 대한 문제 메시지 변형을 알리기 위해 SARIF(Static Analysis Results Interchange Format) 보고서에 사용되는 식별자입니다. 네
messageTemplates.messageTemplate string 규칙이 보고하는 문제 시나리오에 대한 메시지 변형 텍스트입니다. 이 텍스트는 SARIF 보고서에 제공된 인수를 사용하여 자세한 메시지를 구성할 수 있는 토큰을 포함할 수 있는 형식 문자열입니다. 네

예: 다른 언어로 된 규칙 세트의 규칙 검색

이 예는 프랑스어로 솔루션 검사기 규칙 세트의 모든 규칙에 대한 데이터를 반환합니다. 원하는 언어가 영어인 경우 Accept-Language 헤더를 제거하십시오.

Request

GET [Geographical URI]/api/rule?ruleset=083A2EF5-7E0E-4754-9D88-9455142DC08B&api-version=2.0
x-ms-correlation-id: aaaa0000-bb11-2222-33cc-444444dddddd
Accept: application/json
Content-Type: application/json; charset=utf-8
Accept-Language: fr

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
    {
        "description": "Ne pas implémenter d’activités de workflow Microsoft Dynamics CRM 4.0",
        "guidanceUrl": "https://go.microsoft.com/fwlink/?LinkID=398563&error=il-avoid-crm4-wf&client=PAChecker",
        "include": true,
        "code": "il-avoid-crm4-wf",
        "summary": "Ne pas implémenter d’activités de workflow Microsoft Dynamics CRM 4.0",
        "howToFix": {
            "summary": ""
        }
    },
    {
        "description": "Utiliser InvalidPluginExecutionException dans des plug-ins et activités de workflow",
        "guidanceUrl": "https://go.microsoft.com/fwlink/?LinkID=398563&error=il-use-standard-exception&client=PAChecker",
        "include": true,
        "code": "il-use-standard-exception",
        "summary": "Utiliser InvalidPluginExecutionException dans des plug-ins et activités de workflow",
        "howToFix": {
            "summary": ""
        }
    },
...
]

예: 모두 검색

이 예는 사용 가능한 모든 규칙에 대한 데이터를 반환합니다.

Request

GET [Geographical URI]/api/rule?api-version=2.0
Accept: application/json
Content-Type: application/json; charset=utf-8

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
    {
        "description": "Retrieve specific columns for an entity via query APIs",
        "guidanceUrl": "https://go.microsoft.com/fwlink/?LinkID=398563&error=il-specify-column&client=PAChecker",
        "include": true,
        "code": "il-specify-column",
        "summary": "Retrieve specific columns for an entity via query APIs",
        "howToFix": {
            "summary": ""
        }
    },
    {
        "description": "Do not duplicate plug-in step registration",
        "guidanceUrl": "https://go.microsoft.com/fwlink/?LinkID=398563&error=meta-remove-dup-reg&client=PAChecker",
        "include": true,
        "code": "meta-remove-dup-reg",
        "summary": "Do not duplicate plug-in step registration",
        "howToFix": {
            "summary": ""
        }
    },
...
]

예: 메시지 형식으로 규칙 세트 검색

이 예는 프랑스어로 솔루션 검사기 규칙 세트의 모든 규칙에 대한 데이터를 반환합니다. 원하는 언어가 영어인 경우 Accept-Language 헤더를 제거하십시오.

Request

GET [Geographical URI]/api/rule?ruleset=083A2EF5-7E0E-4754-9D88-9455142DC08B&includeMessageFormats=true&api-version=2.0
Accept: application/json
Content-Type: application/json; charset=utf-8

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
    {
        "description": "Do not implement Microsoft Dynamics CRM 4.0 workflow activities",
        "guidanceUrl": "https://go.microsoft.com/fwlink/?LinkID=398563&error=il-avoid-crm4-wf&client=PAChecker",
        "include": true,
        "code": "il-avoid-crm4-wf",
        "summary": "Do not implement Microsoft Dynamics CRM 4.0 workflow activities",
        "howToFix": {
            "summary": ""
        },
        "messageTemplates": [
            {
                "ruleId": "il-avoid-crm4-wf",
                "messageTemplateId": "message1",
                "messageTemplate": "Update the {0} class to derive from System.Workflow.Activities.CodeActivity, refactor Execute method implementation, and remove Microsoft.Crm.Workflow.CrmWorkflowActivityAttribute from type"
            },
            {
                "ruleId": "il-avoid-crm4-wf",
                "messageTemplateId": "message2",
                "messageTemplate": "Change the {0} property's type from {1} to {2} Argument <T> type"
            },
            {
                "ruleId": "il-avoid-crm4-wf",
                "messageTemplateId": "message3",
                "messageTemplate": "Replace the Microsoft.Crm.Workflow.Crm{0}Attribute with Microsoft.Xrm.Sdk.Workflow.{0}Attribute"
            },
            {
                "ruleId": "il-avoid-crm4-wf",
                "messageTemplateId": "message4",
                "messageTemplate": "Remove the {0} System.Workflow.ComponentModel.DependencyProperty type field"
            }
        ]
    },
    {
        "description": "Use InvalidPluginExecutionException in plug-ins and workflow activities",
        "guidanceUrl": "https://go.microsoft.com/fwlink/?LinkID=398563&error=il-use-standard-exception&client=PAChecker",
        "include": true,
        "code": "il-use-standard-exception",
        "summary": "Use InvalidPluginExecutionException in plug-ins and workflow activities",
        "howToFix": {
            "summary": ""
        },
        "messageTemplates": [
            {
                "ruleId": "il-use-standard-exception",
                "messageTemplateId": "message1",
                "messageTemplate": "An unguarded throw of type {0} was detected. Refactor this code to either throw an exception of type InvalidPluginExecutionException or guard against thrown exceptions of other types."
            },
            {
                "ruleId": "il-use-standard-exception",
                "messageTemplateId": "message2",
                "messageTemplate": "An unguarded rethrow of type {0} was detected. Refactor this code to either throw an exception of type InvalidPluginExecutionException or guard against thrown exceptions of other types."
            }
        ]
    },
...
]

참조

Power Apps 체커 웹 API를 사용하세요
규칙 세트의 목록 검색
파일 업로드
분석 호출
분석 상태 확인