GitLab API Updating a wiki article with a path separator

Let’s say I have a wiki article at: wikis/reporting/MyNewReport

Describe your question in as much detail as possible:

  • What are you seeing, and how does it differ from what you expect to see? I am seeing a 404 instead of the markdown content
  • Consider including screenshots, error messages, and/or other helpful visuals
    I just keep getting Error 404 Not Found as a JSON response
  • What version are you on (Hint: /help) ? and are you using self-managed or
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

I have looked at Project wikis API | GitLab and used the GET endpoint api/v4/projects/XXXXX/wikis/ to get the slug and then did a regular GET project request… it works for all slugs that have NO / path separators but it DOES not work for the slugs that have at least / one or more.

I am also following this: Wiki | GitLab

How do I get the markdown content of the API via a GET request of wiki pages that have a / path separator in the slug?

This is what I have: curl --header "PRIVATE-TOKEN: <MY PRIV TOKEN>" https://MYGITLABWEBSITE.COM/api/v4/projects/XXXX/wikis/reporting/MyNewReport but I keep getting a 404.

Hi @naknode - when you have a wiki path with a slash /, you need to encode it with %2F. Otherwise GitLab thinks you are accessing an API endpoint that doesn’t exist, hence the 404.

Can you try your curl command again like this and let me know if that works:

curl --header "PRIVATE-TOKEN: <MY PRIV TOKEN>" https://MYGITLABWEBSITE.COM/api/v4/projects/XXXX/wikis/reporting%2FMyNewReport

Oh, that makes sense. I completely forgot about the encoding part. Thank you!