אחזור רשימת הכללים

הכללים מקובצים יחד באמצעות ערכת כללים. כלל כלשהו יכול להימצא בכמה ערכות כללים או באף אחת מהן. השתמש בבקשת GET כדי להשיג רשימה של כל הכללים הזמינים, כללים בערכת כללים או ערכות כללים על-ידי קריאה לממשק ה- API‏ [Geographical URI]/api/rule. קיימות כמה וריאציות של הקריאה ל- API זה. עם זאת, השימוש הנפוץ ביותר הוא אחזור רשימת הכללים עבור ערכת כללים ספציפית.

הערה

‏API זה אינו מחייב שימוש באסימון OAuth, אך הוא יכול לקבל אסימון אם הוא סופק.

כותרות עליונות

שם סוג ערך צפוי נדרש?
Accept-Language string קוד השפה (למשל, he-IL). ברירת המחדל היא en-US. לא

פרמטרים

שם סוג ערך צפוי נדרש?
ruleset string השם או המזהה של ערכת הכללים או רשימת מזהי ערכת כללים, או שמות המופרדים באמצעות פסיק או נקודה-פסיק (למשל, "בודק הפתרונות"). לא
includeMessageFormats bool כאשר פרמטר זה מוגדר ל- true, רשימת הווריאציות האפשריות של ההודעה כלולה בתוצאות של בקשות השפות, אם היא זמינה. הוא שימושי עבור תרגומים לכמה שפות. אם אין צורך בו, אל תספק פרמטר זה או ספק false בתור הערך, מכיוון שפרמטר זה יגדיל את גודל התגובה ועשוי להאריך את זמן העיבוד. לא

תגובות צפויות

קוד מצב HTTP תרחיש תוצאה
200 נמצאה תוצאה אחת או יותר עיין בדוגמה שלהלן. ייתכן שתוחזר תוצאה אחת או יותר.
204 לא נמצאו תוצאות אין תוצאות בגוף התגובה.

גוף התגובה הצפוי

הטבלה הבאה מפרטת את מבנה התגובה עבור כל בקשה (תגובת HTTP של 200 בלבד).

מאפיין סוג ערך צפוי נדרש?
code string מזהה הכלל. כן
summary string סיכום של הכלל. כן
description string תיאור מפורט יותר של הכלל. כן
guidanceUrl URI כתובת ה- URL שבה ניתן למצוא הנחיות שפורסמו. יתכנו מקרים שבהם אין מאמר ייעודי של הנחיות ותמיכה. כן
include boolean איתותים לשירות שיש לכלול את הכלל אמור בניתוח. הערך יהיה true עבור API זה. לא
messageTemplates array ערך מאפיין זה כלול רק כאשר includeMessageFormats הוא true. לא
messageTemplates.ruleId string מחזיר את אותו ערך מזהה כמו המאפיין code. כן
messageTemplates.messageTemplateId string מזהה שבו נעשה שימוש בדוח Static Analysis Results Interchange Format ‏(SARIF) כדי לאותת על וריאציה של הודעת הבעיה עבור הכלל. כן
messageTemplates.messageTemplate string הטקסט של וריאציית ההודעה עבור תרחיש הבעיה שהכלל מדווח עליו. זוהי מחרוזת תבנית שעשויה להכיל אסימונים. במחרוזת זו, ניתן להשתמש בארגומנטים שסופקו בדוח SARIF כדי לבנות הודעה מפורטת. כן

דוגמה: אחזור כללים עבור ערכת כללים בשפה אחרת

דוגמה זו מחזירה נתונים עבור כל הכללים בערכת הכללים בודק הפתרונות בשפה הצרפתית. אם השפה הרצויה היא אנגלית, פשוט הסר את הכותרת העליונה של Accept-Language.

בקשה

GET [Geographical URI]/api/rule?ruleset=083A2EF5-7E0E-4754-9D88-9455142DC08B&api-version=1.0
x-ms-correlation-id: 9E378E56-6F35-41E9-BF8B-C0CC88E2B832
Accept: application/json
Content-Type: application/json; charset=utf-8
Accept-Language: fr

תגובה

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": ""
        }
    },
...
]

דוגמה: אחזור הכל

דוגמה זו מחזירה נתונים עבור כל הכללים הזמינים.

בקשה

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

תגובה

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.

בקשה

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

תגובה

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."
            }
        ]
    },
...
]

למידע נוסף

שימוש ב- API של אינטרנט של בודק Power Apps
אחזור רשימת ערכות הכללים
העלאת קובץ
הפעלת ניתוח
בדיקת מצב הניתוח