Project Variables API: Add project ID to CI Variables payload

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Problem to solve

Missing attributes for in the API to have a small ORM layer on it. Building a API with Spyke

Intended users

Developers that use the API

Further details

Better API consistency and relation links to go back

Proposal

Add a PR to add new fields to the API

Permissions and Security

No extra permissions needed

Documentation

Expand the documentation with the new attributes

Testing

No additional risks due to only changes in the serializers

What does success look like, and how can we measure that?

A api what can be used to walk trough with other ORM software. This can make integration by managing the projects much easier.

Links / references

Example

api/v4/projects/1/variables

[
  {
    "key": "VARIABLE_1",
    "value": "VALUE1",
    "protected": false
  }
]

In order to make a reference back to the project we need to be able to fill this url projects/:project_id/variables(/:key) So the suggestion is:

[
  {
    "key": "VARIABLE_1",
    "value": "VALUE1",
    "protected": false,
    "project_id": 1
  }
]

This is missing on more elements. Also on api/v4/projects is the owner set. But it does not have a owner_id exposed in the result. Making this more consistent will make tools like Spike work. Then you can have a normal ORM as if you are using "ActiveRecord" like models.

Edited Aug 26, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading