Deletes an issue. This example deletes the issue having key = "SCRUM-13". A successful delete is indicated by a response status code equal to 204 with an empty response body. This example demonstrates one possible JSON error response (where the response status code was 403).
curl -X DELETE --user jira@example.com:JIRA_API_TOKEN \
--header 'Accept: application/json' \
--url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13'
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
DECLARE @sTmp0 nvarchar(4000)
DECLARE @rest int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13
DECLARE @bTls int
SELECT @bTls = 1
DECLARE @port int
SELECT @port = 443
DECLARE @bAutoReconnect int
SELECT @bAutoReconnect = 1
EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'your-domain.atlassian.net', STR(@port), STR(@bTls), STR(@bAutoReconnect)
IF STR(@success) <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'ConnectFailReason', @iTmp0 OUT
PRINT 'ConnectFailReason: ' + @iTmp0
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
RETURN
END
EXEC sp_OAMethod @rest, 'SetAuthBasic', @success OUT, 'jira@example.com', 'JIRA_API_TOKEN'
EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'Accept', 'application/json'
DECLARE @sbResponseBody int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @rest, 'FullRequestNoBodySb', @success OUT, 'DELETE', '/rest/api/2/issue/SCRUM-13', STR(@sbResponseBody)
IF STR(@success) <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @respStatusCode OUT
IF STR(@respStatusCode) >= 400
BEGIN
PRINT 'Response Status Code = ' + STR(@respStatusCode)
PRINT 'Response Header:'
EXEC sp_OAGetProperty @rest, 'ResponseHeader', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Response Body:'
EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @jsonResponse int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jsonResponse OUT
EXEC sp_OAMethod @jsonResponse, 'LoadSb', @success OUT, STR(@sbResponseBody)
DECLARE @i int
DECLARE @count_i int
DECLARE @strVal nvarchar(4000)
SELECT @i = 0
EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, 'errorMessages'
WHILE STR(@i) < STR(@count_i)
BEGIN
EXEC sp_OASetProperty @jsonResponse, 'I', STR(@i)
EXEC sp_OAMethod @jsonResponse, 'StringOf', @strVal OUT, 'errorMessages[i]'
SELECT @i = STR(@i) + 1
END
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jsonResponse
END
GO
{
"errorMessages": [
"You do not have permission to delete issues in this project."
],
"errors": {}
}