From 522ecffdb6f07e6c017139df4eb5d3fc42a585b7 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sat, 25 Jun 2022 14:19:07 +0200 Subject: [PATCH] docs(projects): document 404 gotcha with unactivated integrations --- docs/gl_objects/projects.rst | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst index fcf55e620..7569d7489 100644 --- a/docs/gl_objects/projects.rst +++ b/docs/gl_objects/projects.rst @@ -628,7 +628,23 @@ Reference Examples --------- -Get a service:: +.. danger:: + + Since GitLab 13.12, ``get()`` calls to project services return a + ``404 Not Found`` response until they have been activated the first time. + + To avoid this, we recommend using `lazy=True` to prevent making + the initial call when activating new services unless they have + previously already been activated. + +Configure and enable a service for the first time:: + + service = project.services.get('asana', lazy=True) + + service.api_key = 'randomkey' + service.save() + +Get an existing service:: service = project.services.get('asana') # display its status (enabled/disabled) @@ -642,11 +658,6 @@ List the code names of available services (doesn't return objects):: services = project.services.available() -Configure and enable a service:: - - service.api_key = 'randomkey' - service.save() - Disable a service:: service.delete()