Hi
I try to find out when labels where added/removed from an issue by API. So far all my requests where done by GraphQl. But now with the labels it looks like i can only get these with the REST API.
Do i use the api wrong? Or is that a bug in the API?
Thanks Fabian
Example:
curl 'https://gitlab.com/fabianpage/discussionsapiexample/-/issues/1/discussions.json'
Result from REST API with label changes
[
{
"id": "e009f9af3c842c7a371add1b04c0f97de1c1eca7",
"reply_id": "e009f9af3c842c7a371add1b04c0f97de1c1eca7",
"project_id": 36062084,
"commit_id": null,
"confidential": false,
"diff_discussion": false,
"expanded": true,
"for_commit": false,
"individual_note": true,
"resolvable": false,
"resolved_by_push": false,
"discussion_path": null,
"notes": [
{
"id": "e009f9af3c842c7a371add1b04c0f97de1c1eca7",
"type": "LabelNote",
"attachment": null,
"author": {
"id": 5515162,
"username": "fabianpage",
"name": "Fabian Page",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/b85d10a41f46713500c3943f391acb76?s=80&d=identicon",
"status_tooltip_html": null,
"show_status": false,
"availability": null,
"path": "/fabianpage"
},
"created_at": "2022-05-11T05:52:42.877Z",
"updated_at": null,
"system": true,
"noteable_id": 108344635,
"noteable_type": "Issue",
"resolvable": false,
"confidential": false,
"noteable_iid": 1,
"commands_changes": {},
"note": "added ~25070784 label",
"note_html": "<p dir=\"auto\">added <span class=\"gl-label gl-label-sm\"><a href=\"/fabianpage/discussionsapiexample/-/issues?label_name=Label+A\" data-original=\"~25070784\" data-link=\"false\" data-link-reference=\"false\" data-project=\"36062084\" data-label=\"25070784\" data-reference-type=\"label\" data-container=\"body\" data-placement=\"top\" title=\"\" class=\"gfm gfm-label has-tooltip gl-link gl-label-link\"><span class=\"gl-label-text gl-label-text-light\" data-container=\"body\" data-html=\"true\" style=\"background-color: #330066\">Label A</span></a></span> label</p>",
"current_user": {
"can_edit": false,
"can_award_emoji": false,
"can_resolve": false,
"can_resolve_discussion": false
},
"suggestions": [],
"resolved": false,
"resolved_by": null,
"system_note_icon_name": "label",
"is_noteable_author": true,
"discussion_id": "e009f9af3c842c7a371add1b04c0f97de1c1eca7",
"emoji_awardable": false,
"report_abuse_path": "/-/abuse_reports/new?ref_url=https%3A%2F%2Fgitlab.com%2Ffabianpage%2Fdiscussionsapiexample%2F-%2Fissues%2F1%23new_note&user_id=5515162",
"noteable_note_url": null,
"cached_markdown_version": null,
"description_version_id": null,
"can_delete_description_version": false,
"description_version_deleted": null,
"human_access": "Owner",
"is_contributor": false,
"project_name": "DiscussionsApiExample"
}
],
"resolved": false,
"resolved_by": null,
"resolved_at": null
},
{
"id": "00d8ac2b56aec12fe4d6a868418e9239ef0bd720",
"reply_id": "00d8ac2b56aec12fe4d6a868418e9239ef0bd720",
"project_id": 36062084,
"commit_id": null,
"confidential": false,
"diff_discussion": false,
"expanded": true,
"for_commit": false,
"individual_note": true,
"resolvable": false,
"resolved_by_push": false,
"discussion_path": null,
"notes": [
{
"id": "00d8ac2b56aec12fe4d6a868418e9239ef0bd720",
"type": "LabelNote",
"attachment": null,
"author": {
"id": 5515162,
"username": "fabianpage",
"name": "Fabian Page",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/b85d10a41f46713500c3943f391acb76?s=80&d=identicon",
"status_tooltip_html": null,
"show_status": false,
"availability": null,
"path": "/fabianpage"
},
"created_at": "2022-05-11T05:52:44.337Z",
"updated_at": null,
"system": true,
"noteable_id": 108344635,
"noteable_type": "Issue",
"resolvable": false,
"confidential": false,
"noteable_iid": 1,
"commands_changes": {},
"note": "removed ~25070784 label",
"note_html": "<p dir=\"auto\">removed <span class=\"gl-label gl-label-sm\"><a href=\"/fabianpage/discussionsapiexample/-/issues?label_name=Label+A\" data-original=\"~25070784\" data-link=\"false\" data-link-reference=\"false\" data-project=\"36062084\" data-label=\"25070784\" data-reference-type=\"label\" data-container=\"body\" data-placement=\"top\" title=\"\" class=\"gfm gfm-label has-tooltip gl-link gl-label-link\"><span class=\"gl-label-text gl-label-text-light\" data-container=\"body\" data-html=\"true\" style=\"background-color: #330066\">Label A</span></a></span> label</p>",
"current_user": {
"can_edit": false,
"can_award_emoji": false,
"can_resolve": false,
"can_resolve_discussion": false
},
"suggestions": [],
"resolved": false,
"resolved_by": null,
"system_note_icon_name": "label",
"is_noteable_author": true,
"discussion_id": "00d8ac2b56aec12fe4d6a868418e9239ef0bd720",
"emoji_awardable": false,
"report_abuse_path": "/-/abuse_reports/new?ref_url=https%3A%2F%2Fgitlab.com%2Ffabianpage%2Fdiscussionsapiexample%2F-%2Fissues%2F1%23new_note&user_id=5515162",
"noteable_note_url": null,
"cached_markdown_version": null,
"description_version_id": null,
"can_delete_description_version": false,
"description_version_deleted": null,
"human_access": "Owner",
"is_contributor": false,
"project_name": "DiscussionsApiExample"
}
],
"resolved": false,
"resolved_by": null,
"resolved_at": null
},
{
"id": "ab4dd662a5ed1da9e1764b814d82a61e296c10da",
"reply_id": "ab4dd662a5ed1da9e1764b814d82a61e296c10da",
"project_id": 36062084,
"commit_id": null,
"confidential": false,
"diff_discussion": false,
"expanded": true,
"for_commit": false,
"individual_note": true,
"resolvable": false,
"resolved_by_push": false,
"discussion_path": null,
"notes": [
{
"id": "942188873",
"type": null,
"attachment": null,
"author": {
"id": 5515162,
"username": "fabianpage",
"name": "Fabian Page",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/b85d10a41f46713500c3943f391acb76?s=80&d=identicon",
"status_tooltip_html": null,
"show_status": false,
"availability": null,
"path": "/fabianpage"
},
"created_at": "2022-05-11T05:52:52.405Z",
"updated_at": "2022-05-11T05:52:52.405Z",
"system": false,
"noteable_id": 108344635,
"noteable_type": "Issue",
"resolvable": false,
"confidential": false,
"noteable_iid": 1,
"commands_changes": {},
"note": "Label A added and removed",
"note_html": "<p data-sourcepos=\"1:1-1:25\" dir=\"auto\">Label A added and removed</p>",
"current_user": {
"can_edit": false,
"can_award_emoji": false,
"can_resolve": false,
"can_resolve_discussion": false
},
"suggestions": [],
"resolved": false,
"resolved_by": null,
"is_noteable_author": true,
"discussion_id": "ab4dd662a5ed1da9e1764b814d82a61e296c10da",
"emoji_awardable": true,
"award_emoji": [],
"report_abuse_path": "/-/abuse_reports/new?ref_url=https%3A%2F%2Fgitlab.com%2Ffabianpage%2Fdiscussionsapiexample%2F-%2Fissues%2F1%23note_942188873&user_id=5515162",
"noteable_note_url": "https://gitlab.com/fabianpage/discussionsapiexample/-/issues/1#note_942188873",
"cached_markdown_version": 1966085,
"human_access": "Owner",
"is_contributor": false,
"project_name": "DiscussionsApiExample",
"toggle_award_path": "/fabianpage/discussionsapiexample/notes/942188873/toggle_award_emoji",
"path": "/fabianpage/discussionsapiexample/notes/942188873"
}
],
"resolved": false,
"resolved_by": null,
"resolved_at": null
},
{
"id": "c78757730212cc5c35799863d579c88b740dd15f",
"reply_id": "c78757730212cc5c35799863d579c88b740dd15f",
"project_id": 36062084,
"commit_id": null,
"confidential": false,
"diff_discussion": false,
"expanded": true,
"for_commit": false,
"individual_note": true,
"resolvable": false,
"resolved_by_push": false,
"discussion_path": null,
"notes": [
{
"id": "c78757730212cc5c35799863d579c88b740dd15f",
"type": "LabelNote",
"attachment": null,
"author": {
"id": 5515162,
"username": "fabianpage",
"name": "Fabian Page",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/b85d10a41f46713500c3943f391acb76?s=80&d=identicon",
"status_tooltip_html": null,
"show_status": false,
"availability": null,
"path": "/fabianpage"
},
"created_at": "2022-05-11T05:52:57.003Z",
"updated_at": null,
"system": true,
"noteable_id": 108344635,
"noteable_type": "Issue",
"resolvable": false,
"confidential": false,
"noteable_iid": 1,
"commands_changes": {},
"note": "added ~25070786 label",
"note_html": "<p dir=\"auto\">added <span class=\"gl-label gl-label-sm\"><a href=\"/fabianpage/discussionsapiexample/-/issues?label_name=Label+B\" data-original=\"~25070786\" data-link=\"false\" data-link-reference=\"false\" data-project=\"36062084\" data-label=\"25070786\" data-reference-type=\"label\" data-container=\"body\" data-placement=\"top\" title=\"\" class=\"gfm gfm-label has-tooltip gl-link gl-label-link\"><span class=\"gl-label-text gl-label-text-light\" data-container=\"body\" data-html=\"true\" style=\"background-color: #00b140\">Label B</span></a></span> label</p>",
"current_user": {
"can_edit": false,
"can_award_emoji": false,
"can_resolve": false,
"can_resolve_discussion": false
},
"suggestions": [],
"resolved": false,
"resolved_by": null,
"system_note_icon_name": "label",
"is_noteable_author": true,
"discussion_id": "c78757730212cc5c35799863d579c88b740dd15f",
"emoji_awardable": false,
"report_abuse_path": "/-/abuse_reports/new?ref_url=https%3A%2F%2Fgitlab.com%2Ffabianpage%2Fdiscussionsapiexample%2F-%2Fissues%2F1%23new_note&user_id=5515162",
"noteable_note_url": null,
"cached_markdown_version": null,
"description_version_id": null,
"can_delete_description_version": false,
"description_version_deleted": null,
"human_access": "Owner",
"is_contributor": false,
"project_name": "DiscussionsApiExample"
}
],
"resolved": false,
"resolved_by": null,
"resolved_at": null
},
{
"id": "210999c9ca9e93df09935cf7baf9258da221c3e4",
"reply_id": "210999c9ca9e93df09935cf7baf9258da221c3e4",
"project_id": 36062084,
"commit_id": null,
"confidential": false,
"diff_discussion": false,
"expanded": true,
"for_commit": false,
"individual_note": true,
"resolvable": false,
"resolved_by_push": false,
"discussion_path": null,
"notes": [
{
"id": "942188940",
"type": null,
"attachment": null,
"author": {
"id": 5515162,
"username": "fabianpage",
"name": "Fabian Page",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/b85d10a41f46713500c3943f391acb76?s=80&d=identicon",
"status_tooltip_html": null,
"show_status": false,
"availability": null,
"path": "/fabianpage"
},
"created_at": "2022-05-11T05:53:01.030Z",
"updated_at": "2022-05-11T05:53:01.030Z",
"system": false,
"noteable_id": 108344635,
"noteable_type": "Issue",
"resolvable": false,
"confidential": false,
"noteable_iid": 1,
"commands_changes": {},
"note": "Label B added",
"note_html": "<p data-sourcepos=\"1:1-1:13\" dir=\"auto\">Label B added</p>",
"current_user": {
"can_edit": false,
"can_award_emoji": false,
"can_resolve": false,
"can_resolve_discussion": false
},
"suggestions": [],
"resolved": false,
"resolved_by": null,
"is_noteable_author": true,
"discussion_id": "210999c9ca9e93df09935cf7baf9258da221c3e4",
"emoji_awardable": true,
"award_emoji": [],
"report_abuse_path": "/-/abuse_reports/new?ref_url=https%3A%2F%2Fgitlab.com%2Ffabianpage%2Fdiscussionsapiexample%2F-%2Fissues%2F1%23note_942188940&user_id=5515162",
"noteable_note_url": "https://gitlab.com/fabianpage/discussionsapiexample/-/issues/1#note_942188940",
"cached_markdown_version": 1966085,
"human_access": "Owner",
"is_contributor": false,
"project_name": "DiscussionsApiExample",
"toggle_award_path": "/fabianpage/discussionsapiexample/notes/942188940/toggle_award_emoji",
"path": "/fabianpage/discussionsapiexample/notes/942188940"
}
],
"resolved": false,
"resolved_by": null,
"resolved_at": null
}
]
so with the REST API i get all the changes of the labels.
But if i query with:
query GetDiscussions {
project(fullPath: "fabianpage/discussionsapiexample") {
issue(iid: "1") {
discussions
{
nodes {
id
notes {
nodes {
id
body
createdAt
}
}
}
}
}
}
}
Result from GraphQL, missing all label changes
{
"data": {
"project": {
"issue": {
"discussions": {
"nodes": [
{
"id": "gid://gitlab/IndividualNoteDiscussion/ab4dd662a5ed1da9e1764b814d82a61e296c10da",
"notes": {
"nodes": [
{
"id": "gid://gitlab/Note/942188873",
"body": "Label A added and removed",
"createdAt": "2022-05-11T05:52:52Z"
}
]
}
},
{
"id": "gid://gitlab/IndividualNoteDiscussion/210999c9ca9e93df09935cf7baf9258da221c3e4",
"notes": {
"nodes": [
{
"id": "gid://gitlab/Note/942188940",
"body": "Label B added",
"createdAt": "2022-05-11T05:53:01Z"
}
]
}
}
]
}
}
}
}
}