SQL Server / Atlassian Confluence Cloud / Get inline tasks based on search parameters
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
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'start', 0
EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'limit', 20
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'spaceKey', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'pageId', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'assignee', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'creator', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'completedUser', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'duedateFrom', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'duedateTo', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'createdateFrom', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'createdateTo', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'completedateFrom', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'completedateTo', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'status', ''
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://your-domain.atlassian.net/wiki/rest/api/inlinetasks/search', @queryParams
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 @queryParams
RETURN
END
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @resp
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "results": [
-- {
-- "globalId": 73402911,
-- "id": -12315776,
-- "contentId": -64437499,
-- "status": "adipisicing reprehenderit",
-- "creator": "eiusmod adipisicing nostrud elit aliqua",
-- "createDate": 96545196,
-- "title": "eiusmod Duis",
-- "description": "est voluptate consectetur",
-- "body": "ut dolor laborum amet in",
-- "assignee": "id qui Excepteur veniam",
-- "completeUser": "dolor in",
-- "dueDate": -37801344,
-- "updateDate": -17760646,
-- "completeDate": -16013738
-- },
-- {
-- "globalId": 10778681,
-- "id": 56408304,
-- "contentId": -21387009,
-- "status": "ut in nulla",
-- "creator": "amet laborum tempor dolor culpa",
-- "createDate": -75309367,
-- "title": "esse cillum dolor magna",
-- "description": "fugiat",
-- "body": "aliqua enim",
-- "assignee": "exercitation eiusmod dolore et occaecat",
-- "completeUser": "nisi irure incididunt",
-- "dueDate": -59867179,
-- "updateDate": 535300,
-- "completeDate": -27504056
-- }
-- ],
-- "start": 92594856,
-- "limit": 14573716,
-- "size": -75971688
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @globalId int
DECLARE @id int
DECLARE @contentId int
DECLARE @status nvarchar(4000)
DECLARE @creator nvarchar(4000)
DECLARE @createDate int
DECLARE @title nvarchar(4000)
DECLARE @description nvarchar(4000)
DECLARE @body nvarchar(4000)
DECLARE @assignee nvarchar(4000)
DECLARE @completeUser nvarchar(4000)
DECLARE @dueDate int
DECLARE @updateDate int
DECLARE @completeDate int
DECLARE @start int
EXEC sp_OAMethod @jResp, 'IntOf', @start OUT, 'start'
DECLARE @limit int
EXEC sp_OAMethod @jResp, 'IntOf', @limit OUT, 'limit'
DECLARE @size int
EXEC sp_OAMethod @jResp, 'IntOf', @size OUT, 'size'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'results'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'IntOf', @globalId OUT, 'results[i].globalId'
EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'results[i].id'
EXEC sp_OAMethod @jResp, 'IntOf', @contentId OUT, 'results[i].contentId'
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'results[i].status'
EXEC sp_OAMethod @jResp, 'StringOf', @creator OUT, 'results[i].creator'
EXEC sp_OAMethod @jResp, 'IntOf', @createDate OUT, 'results[i].createDate'
EXEC sp_OAMethod @jResp, 'StringOf', @title OUT, 'results[i].title'
EXEC sp_OAMethod @jResp, 'StringOf', @description OUT, 'results[i].description'
EXEC sp_OAMethod @jResp, 'StringOf', @body OUT, 'results[i].body'
EXEC sp_OAMethod @jResp, 'StringOf', @assignee OUT, 'results[i].assignee'
EXEC sp_OAMethod @jResp, 'StringOf', @completeUser OUT, 'results[i].completeUser'
EXEC sp_OAMethod @jResp, 'IntOf', @dueDate OUT, 'results[i].dueDate'
EXEC sp_OAMethod @jResp, 'IntOf', @updateDate OUT, 'results[i].updateDate'
EXEC sp_OAMethod @jResp, 'IntOf', @completeDate OUT, 'results[i].completeDate'
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -G -d "start=0"
-d "limit=20"
-d "spaceKey="
-d "pageId="
-d "assignee="
-d "creator="
-d "completedUser="
-d "duedateFrom="
-d "duedateTo="
-d "createdateFrom="
-d "createdateTo="
-d "completedateFrom="
-d "completedateTo="
-d "status="
-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/inlinetasks/search
Postman Collection Item JSON
{
"name": "Get inline tasks based on search parameters",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/inlinetasks/search?start=0&limit=20&spaceKey=&pageId=&assignee=&creator=&completedUser=&duedateFrom=&duedateTo=&createdateFrom=&createdateTo=&completedateFrom=&completedateTo=&status=",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"inlinetasks",
"search"
],
"query": [
{
"key": "start",
"value": "0",
"description": "The starting offset for the results."
},
{
"key": "limit",
"value": "20",
"description": "The number of results to be returned."
},
{
"key": "spaceKey",
"value": "",
"description": "The space key of a space. Multiple space keys can be specified."
},
{
"key": "pageId",
"value": "",
"description": "The page id of a page. Multiple page ids can be specified."
},
{
"key": "assignee",
"value": "",
"description": "Account ID of a user to whom a task is assigned. Multiple users can be specified."
},
{
"key": "creator",
"value": "",
"description": "Account ID of a user to who created a task. Multiple users can be specified."
},
{
"key": "completedUser",
"value": "",
"description": "Account ID of a user who completed a task. Multiple users can be specified."
},
{
"key": "duedateFrom",
"value": "",
"description": "Start of date range based on due dates (inclusive)."
},
{
"key": "duedateTo",
"value": "",
"description": "End of date range based on due dates (inclusive)."
},
{
"key": "createdateFrom",
"value": "",
"description": "Start of date range based on create dates (inclusive)."
},
{
"key": "createdateTo",
"value": "",
"description": "End of date range based on create dates (inclusive)."
},
{
"key": "completedateFrom",
"value": "",
"description": "Start of date range based on complete dates (inclusive)."
},
{
"key": "completedateTo",
"value": "",
"description": "End of date range based on complete dates (inclusive)."
},
{
"key": "status",
"value": "",
"description": "The status of the task. (checked/unchecked)"
}
]
},
"description": "Returns inline tasks based on the search query.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to access the Confluence site ('Can use' global permission). Only tasks\nin contents that the user has permission to view are returned."
},
"response": [
{
"name": "Returned if the query fetches zero or more results.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/inlinetasks/search?start=0&limit=20&spaceKey=&pageId=&assignee=&creator=&completedUser=&duedateFrom=&duedateTo=&createdateFrom=&createdateTo=&completedateFrom=&completedateTo=&status=",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"inlinetasks",
"search"
],
"query": [
{
"key": "start",
"value": "0"
},
{
"key": "limit",
"value": "20"
},
{
"key": "spaceKey",
"value": ""
},
{
"key": "pageId",
"value": ""
},
{
"key": "assignee",
"value": ""
},
{
"key": "creator",
"value": ""
},
{
"key": "completedUser",
"value": ""
},
{
"key": "duedateFrom",
"value": ""
},
{
"key": "duedateTo",
"value": ""
},
{
"key": "createdateFrom",
"value": ""
},
{
"key": "createdateTo",
"value": ""
},
{
"key": "completedateFrom",
"value": ""
},
{
"key": "completedateTo",
"value": ""
},
{
"key": "status",
"value": ""
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"results\": [\n {\n \"globalId\": 73402911,\n \"id\": -12315776,\n \"contentId\": -64437499,\n \"status\": \"adipisicing reprehenderit\",\n \"creator\": \"eiusmod adipisicing nostrud elit aliqua\",\n \"createDate\": 96545196,\n \"title\": \"eiusmod Duis\",\n \"description\": \"est voluptate consectetur\",\n \"body\": \"ut dolor laborum amet in\",\n \"assignee\": \"id qui Excepteur veniam\",\n \"completeUser\": \"dolor in\",\n \"dueDate\": -37801344,\n \"updateDate\": -17760646,\n \"completeDate\": -16013738\n },\n {\n \"globalId\": 10778681,\n \"id\": 56408304,\n \"contentId\": -21387009,\n \"status\": \"ut in nulla\",\n \"creator\": \"amet laborum tempor dolor culpa\",\n \"createDate\": -75309367,\n \"title\": \"esse cillum dolor magna\",\n \"description\": \"fugiat\",\n \"body\": \"aliqua enim\",\n \"assignee\": \"exercitation eiusmod dolore et occaecat\",\n \"completeUser\": \"nisi irure incididunt\",\n \"dueDate\": -59867179,\n \"updateDate\": 535300,\n \"completeDate\": -27504056\n }\n ],\n \"start\": 92594856,\n \"limit\": 14573716,\n \"size\": -75971688\n}"
},
{
"name": "Returned if the calling user does not have permission to view\nany content.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/inlinetasks/search?start=0&limit=20&spaceKey=&pageId=&assignee=&creator=&completedUser=&duedateFrom=&duedateTo=&createdateFrom=&createdateTo=&completedateFrom=&completedateTo=&status=",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"inlinetasks",
"search"
],
"query": [
{
"key": "start",
"value": "0"
},
{
"key": "limit",
"value": "20"
},
{
"key": "spaceKey",
"value": ""
},
{
"key": "pageId",
"value": ""
},
{
"key": "assignee",
"value": ""
},
{
"key": "creator",
"value": ""
},
{
"key": "completedUser",
"value": ""
},
{
"key": "duedateFrom",
"value": ""
},
{
"key": "duedateTo",
"value": ""
},
{
"key": "createdateFrom",
"value": ""
},
{
"key": "createdateTo",
"value": ""
},
{
"key": "completedateFrom",
"value": ""
},
{
"key": "completedateTo",
"value": ""
},
{
"key": "status",
"value": ""
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}