Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
Dim queryParams As New ChilkatJsonObject
success = queryParams.UpdateString("key","<string>")
success = queryParams.UpdateString("username","<string>")
success = queryParams.UpdateString("accountId","<string>")
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
Dim resp As ChilkatHttpResponse
Set resp = http.QuickRequestParams("GET","https://your-domain.atlassian.net/wiki/rest/api/user/watch/label/:labelName",queryParams)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Dim sbResponseBody As New ChilkatStringBuilder
success = resp.GetBodySb(sbResponseBody)
Dim jResp As New ChilkatJsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0
Debug.Print "Response Body:"
Debug.Print jResp.Emit()
Dim respStatusCode As Long
respStatusCode = resp.StatusCode
Debug.Print "Response Status Code = " & respStatusCode
If (respStatusCode >= 400) Then
Debug.Print "Response Header:"
Debug.Print resp.Header
Debug.Print "Failed."
Exit Sub
End If
' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)
' {
' "watching": true
' }
' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Dim watching As Long
watching = jResp.BoolOf("watching")
Curl Command
curl -G -d "key=%3Cstring%3E"
-d "username=%3Cstring%3E"
-d "accountId=%3Cstring%3E"
-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/user/watch/label/:labelName
Postman Collection Item JSON
{
"name": "Get label watch status",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/user/watch/label/:labelName?key=<string>&username=<string>&accountId=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"user",
"watch",
"label",
":labelName"
],
"query": [
{
"key": "key",
"value": "<string>",
"description": "This parameter is no longer available and will be removed from the documentation soon.\nUse `accountId` instead.\nSee the [deprecation notice](/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/) for details."
},
{
"key": "username",
"value": "<string>",
"description": "This parameter is no longer available and will be removed from the documentation soon.\nUse `accountId` instead.\nSee the [deprecation notice](/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/) for details."
},
{
"key": "accountId",
"value": "<string>",
"description": "(Required) The `accountId` of the user to be queried for whether they are watching the label. The accountId uniquely identifies\nthe user across all Atlassian products. For example, `384093:32b4d9w0-f6a5-3535-11a3-9c8c88d10192`."
}
],
"variable": [
{
"key": "labelName",
"value": "<string>",
"type": "string",
"description": "(Required) The name of the label to be queried for whether the specified user is\nwatching it."
}
]
},
"description": "Returns whether a user is watching a label. Choose the user by doing one\nof the following:\n\n- Specify a user via a query parameter: Use the `accountId` to identify the user.\n- Do not specify a user: The currently logged-in user will be used.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\n'Confluence Administrator' global permission if specifying a user, otherwise\npermission to access the Confluence site ('Can use' global permission)."
},
"response": [
{
"name": "Returned if the requested watch status is returned.",
"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/user/watch/label/:labelName?key=<string>&username=<string>&accountId=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"user",
"watch",
"label",
":labelName"
],
"query": [
{
"key": "key",
"value": "<string>"
},
{
"key": "username",
"value": "<string>"
},
{
"key": "accountId",
"value": "<string>"
}
],
"variable": [
{
"key": "labelName"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"watching\": true\n}"
},
{
"name": "Returned if;\n\n- A user is specified via a query parameter and the calling user is\nnot a Confluence administrator.\n- No label exists for the specified `labelName`.",
"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/user/watch/label/:labelName?key=<string>&username=<string>&accountId=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"user",
"watch",
"label",
":labelName"
],
"query": [
{
"key": "key",
"value": "<string>"
},
{
"key": "username",
"value": "<string>"
},
{
"key": "accountId",
"value": "<string>"
}
],
"variable": [
{
"key": "labelName"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if no `labelName` is specified.",
"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/user/watch/label/:labelName?key=<string>&username=<string>&accountId=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"user",
"watch",
"label",
":labelName"
],
"query": [
{
"key": "key",
"value": "<string>"
},
{
"key": "username",
"value": "<string>"
},
{
"key": "accountId",
"value": "<string>"
}
],
"variable": [
{
"key": "labelName"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}