GitLab API icon

GitLab API

Gitlab

Actions1062

Projects → patchApiV4ProjectsIdPackagesProtectionRulesPackageProtectionRuleId

AI-generated

Summary

Update an existing package protection rule for a specific GitLab project by providing the project ID (or URL-encoded path), the package protection rule ID, and the new rule details in the request body.

Inputs

  • id (required) — The ID or URL-encoded path of the target GitLab project where the package protection rule exists.
  • package_protection_rule_id (required) — The unique ID of the package protection rule to update within the specified project.
  • patchApiV4ProjectsIdPackagesProtectionRulesPackageProtectionRuleId (required) — A JSON object containing the updated properties for the package protection rule, matching the API's expected schema for package protection rules.
  • skipAuthentication — Toggle to skip using the configured authentication credentials; defaults to false.

Output shape

a single JSON object representing the updated package protection rule as returned by the GitLab API

The response reflects the fully updated package protection rule including any changes made. Authentication is required unless explicitly skipped. Path parameters 'id' and 'package_protection_rule_id' must be supplied correctly for the update to succeed.

Examples

Example 1: Update a project's package protection rule to change its settings

Set 'id' to the project ID, 'package_protection_rule_id' to the rule's ID, and provide the updated rule fields in the request body schema. Execute the PATCH method on the '/api/v4/projects/{id}/packages/protection/rules/{package_protection_rule_id}' endpoint to apply changes.

Links

Discussion