Skip to content

REST services API returns unsaved service objects

Summary

About

The REST GET projects/:id/services/:slug API returns unsaved service objects. For example https://gitlab.com/api/v4/projects/17595187/services/asana (note the "id": null):

{
"id": null,
"title": "Asana",
"slug": "asana",
"created_at": null,
"updated_at": null,
"active": false,
"commit_events": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"comment_on_event_enabled": true,
"properties": {}
}

What is the expected correct behavior?

The API should return a 404 response when a project does not have the service.

Possible fixes

We should replace Project#find_or_initialize_service with Project#integrations#by_type to scope existing integrations.

Edited by Luke Duncalfe