SQL Server / Monitoring API / Change Alarm Compartment
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Use this online tool to generate code from sample JSON: Generate Code to Create JSON
-- The following JSON is sent in the request body.
-- {
-- "compartmentId": "{{compartment_ocid}}"
-- }
DECLARE @json int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compartmentId', '{{compartment_ocid}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Date', '{{date}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'opc-retry-token', 'exercitation commodo'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'if-match', 'pariatur nostrud eiusmod'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'opc-request-id', 'pariatur nostrud eiusmod'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'x-content-sha256', '{{content_sha256}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', '{{signature}}'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://telemetry.{{region}}.oraclecloud.com/20180401/alarms/:alarmId/actions/changeCompartment', 'application/json', @json
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode <> 204
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Response Body:'
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
EXEC @hr = sp_OADestroy @resp
PRINT 'Success.'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
END
GO
Curl Command
curl -X POST
-H "if-match: pariatur nostrud eiusmod"
-H "opc-request-id: pariatur nostrud eiusmod"
-H "opc-retry-token: exercitation commodo"
-H "Content-Type: application/json"
-H "Date: {{date}}"
-H "Authorization: {{signature}}"
-H "x-content-sha256: {{content_sha256}}"
-d '{
"compartmentId": "{{compartment_ocid}}"
}'
https://telemetry.{{region}}.oraclecloud.com/20180401/alarms/:alarmId/actions/changeCompartment
Postman Collection Item JSON
{
"name": "Change Alarm Compartment",
"request": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Date",
"value": "{{date}}",
"description": "(Required) Current Date",
"type": "text"
},
{
"key": "Authorization",
"value": "{{signature}}",
"description": "(Required) Signature Authentication on Authorization header",
"type": "text"
},
{
"key": "x-content-sha256",
"value": "{{content_sha256}}",
"description": "(Required) Content sha256 for POST, PUT and PATCH operations",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"{{compartment_ocid}}\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId",
"value": "mollit in Duis enim",
"description": "(Required) The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of an alarm.\n"
}
]
},
"description": "Moves an alarm into a different compartment within the same tenancy.\n\nFor information about moving resources between compartments, see [Moving Resources Between Compartments](https://docs.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).\n"
},
"response": [
{
"name": "Successfully changed compartment for the specified alarm.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "text",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Bad Request",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
},
{
"name": "Unauthorized",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
},
{
"name": "Not Authorized Or Not Found",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
},
{
"name": "Precondition Failed",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Precondition Failed",
"code": 412,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
},
{
"name": "Client is getting throttled, please retry with backoff.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
},
{
"name": "An error has occurred.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
"key": "if-match",
"value": "pariatur nostrud eiusmod"
},
{
"description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod"
},
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations. For example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmight be rejected.\n",
"key": "opc-retry-token",
"value": "exercitation commodo"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"id do qui commodo\"\n}"
},
"url": {
"raw": "{{baseUrl}}/alarms/:alarmId/actions/changeCompartment",
"host": [
"{{baseUrl}}"
],
"path": [
"alarms",
":alarmId",
"actions",
"changeCompartment"
],
"variable": [
{
"key": "alarmId"
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "pariatur nostrud eiusmod",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
}
]
}