{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":30050,"path":"it-operations-management/discovery-and-service-mapping-patterns/cloud-rest-query-pattern.md","title":"Define a Cloud REST Query for cloud computing devices","bundle":null,"doc_type":null,"release":"australia","body":"\n# Define a Cloud REST Query for cloud computing devices\n\nAs part of creating or modifying a discovery pattern, you can use the **Cloud REST Query** operation to extract information from configuration items \\(CIs\\) of the PaaS \\(Platform as a Service\\) type, such as Microsoft Azure or Amazon Web Services.\n\n## Before you begin\n\n-   Verify that the operating system of the CIs for which you want to use the Cloud REST Query operation extends the Logical Data Center OS type \\[cmdb\\_ci\\_logical\\_datacenter\\]:\n    1.  Navigate to **Pattern Designer** &gt; **Discovery Patterns**.\n    2.  Double-click the relevant pattern to open it in the Pattern Designer.\n    3.  Click the **Basic** tab.\n    4.  Note the operating system for this CI.\n    5.  Navigate to **System Definition** &gt; **Tables**.\n    6.  Set the search field to **Label** and enter the name of the operating system as stated on the **Basic** tab of the pattern.\n    7.  Find the operating system in the list and verify that Logical Datacenter appears in the **Extends table** column.\n-   Navigate to the relevant pattern step:\n\n    1.  On the pattern form, select the relevant identification section for Discovery.\n\n        Alternatively, select the relevant identification or connection section for Service Mapping.\n\n    2.  Select the relevant pattern step or click the **Add a step above** icon to add a step.\n\nBasic knowledge of programming is desirable.\n\nRole required: pd\\_admin\n\n## About this task\n\nDeploy the Cloud REST Query operation in patterns used for discovery of PaaS CIs. This Java-script based custom operation is available only after downloading patterns version 1.0.24 or later from ServiceNow Store. Use this operation instead of the Cloud REST Call operation available in the base system.\n\nRefer to the official API-related documentation provided by manufacturers to obtain the query syntax for the device you want to query using the Cloud REST Query operation. For example:\n\n-   [http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Welcome.html](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Welcome.html)\n-   [https://docs.microsoft.com/en-us/rest/api/apimanagement/](https://docs.microsoft.com/en-us/rest/api/apimanagement/)\n\n## Procedure\n\n1.  Select **Cloud REST Query** from the **Operation** list.\n\n2.  Define query parameters as necessary:\n\n    **Note:** If you customized this operation, the query parameters may be different.\n\n<table id=\"table_d3y_qhuk_sy\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nURL\n\n</td><td>\n\nSpecify the URL as described in the official Microsoft Azure or Amazon Web Services documentation. You can use variables. You can also enter a value from the specific field in a tabular variable.\n\n</td></tr><tr><td>\n\nMethod\n\n</td><td>\n\nEnter the method value as a string using all capital letters, for example \"GET\". Supported methods are:\n\n -   GET\n-   POST\n-   PUT\n Refer to the relevant API guide for information. If the API documentation does not specifically mention the HTTP query method, use the GET method.\n\n</td></tr><tr><td>\n\nBody\n\n</td><td>\n\n\\(Optional\\) Enter a request body as a string. If the string contains quotation marks, use the backslash mark in front of the quotation marks to indicate that the string does not end at the quotation marks.\n\n</td></tr><tr><td>\n\nHeaders\n\n</td><td>\n\n\\(Optional\\) If the relevant API documentation states that HTTP headers must be sent, enter these headers in the following format: Header\\_name1:header\\_value1,header\\_name2:header\\_value2\n\nFor example, `Content-Type:xml`.\n\n</td></tr><tr><td>\n\nFormatted\n\n</td><td>\n\nFormatted JSON or not\n\n</td></tr></tbody>\n</table>3.  To save the command output in its entirety as a variable, select `NONE` from the **Define Parsing** list and define the variable.\n\n4.  Select the parsing strategy from the **Define Parsing** list.\n\n5.  If working in the Debug Mode, define the parsing criteria as follows:\n\n    1.  Click **Run Operation** to see the result in the **Output** pane.\n\n    2.  In the **Output** pane, mark text or symbols that you want a variable to contain.\n\n    3.  In the variable name box, enter the name for the new variable, for example 'process\\_name'.\n\n        \\[Omitted image \"PatDefVariableFromOutput.png\"\\] Alt text: Defining a variable name for the string marked in the Output pane\n\n    4.  Press **Enter**.\n\n        The new variable is added in the **Variables** pane.\n\n6.  If you are not working in Debug Mode, define the parsing criteria as follows:\n\n    1.  In the Variables pane, click **Add Variable** and enter the name for the new variable.\n\n    2.  Click the **Advanced** icon.\n\n        \\[Omitted image \"PatDefAdvanceVariableArea.png\"\\] Alt text: Displaying the Advanced Variables pane\n\n    3.  Click **Add Column Label**.\n\n    4.  Enter the parsing query.\n\n    5.  Enter a value for the delimiter.\n\n    6.  Enter a value for the position.\n\n7.  Select **Terminate** to stop discovery if no results are found.\n\n\n## Example\n\n|This operation is used in|This item|\n|-------------------------|---------|\n|Hierarchy|Application|\n|CI Type|Cloud Object Storage \\[cmdb\\_ci\\_cloud\\_object\\_storage\\]|\n|Pattern|Amazon AWS S3|\n|Section|Identification of AWS S3|\n|Step number and Name|3. List buckets|\n\n\\[Omitted image \"PatDefCloudRESTQueryExample.png\"\\] Alt text: The Cloud REST Query operation\n\nUse the Cloud REST Query operation to extract information about AWS buckets, their names and creation dates.\n\n**Parent Topic:**[AWS discovery using patterns](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/discovery-and-service-mapping-patterns/data-discovered-aws-patterns.md)\n\n"}}