I wanted to start some conversation about adding APIs to CRUD parts of config XML. I have started discussion with Zabil, hopefully will discuss with more people when I get time. The following is the high level overview of what it could look like.
Approach:
The APIs could have end-points like these:
Repository: /go/api/config/package_repositories/package_repository_id
Package: /go/api/config/package_repositories/package_repository_id/packages/package_id
SCM: /go/api/config/scms/scm_id
Group: /go/api/config/groups/pipeline_group_name
Pipeline: /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name
Material: /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name/materials/fingerprint
Stage: /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name/stages/stage_name
Job: /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name/stages/stage_name/jobs/job_name
Task: /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name/stages/stage_name/jobs/job_name/tasks/index
The response will be JSON & request payload for create & update will also be JSON.
Ex:
GET - /go/api/config/groups/group/pipelines/pipeline/stages/stage/jobs/job/tasks/index - will get JSON representation of "group/pipeline/stage/job/" (task at index)
POST - /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name/stages/stage_name/jobs/job_name/tasks/index - with request payload containing JSON representation of "new" task, the new task will be added to "group/pipeline/stage/job/" (at given index)
PUT - /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name/stages/stage_name/jobs/job_name/tasks/index - with request payload containing JSON representation of task at index, the task for "group/pipeline/stage/job/" at given index will be updated
DELETE - /go/api/config/groups/pipeline_group_name/pipelines/pipeline_name/stages/stage_name/jobs/job_name/tasks/index - the task for "group/pipeline/stage/job/" at given index will be deleted
What do you guys think? Does anyone has specific input on this approach? OR Does anyone has alternate approach to suggest?