Reputation: 118
I have been writing automation scripts to generate and update SSL certificates using Namesilo, Letsencrypt and Gitlab APIs. I almost got to the end, but I am getting a 404 error when trying to update the SSL certificate on Gitlab.
The weird part is that the error happens on only one of my two projects. Specifically, running:
curl --header "Private-Token: XXXXXX" "https://gitlab.com/api/v4/projects/pallavagarwal07%2Fshort-links/pages/domains/pallav.xyz"
works fine and fetches the details of domain pallav.xyz
in project short-links
.
But, running:
curl --header "Private-Token: XXXXX" "https://gitlab.com/api/v4/projects/pallavagarwal07%2Fpallavagarwal07.gitlab.io/pages/domains/varstack.com"
returns a 404 error. However, what makes it weirder is that if I remove the domain name varstack.com
from the URL, it gives me the list of domains as expected:
curl --header "Private-Token: XXXXX" "https://gitlab.com/api/v4/projects/pallavagarwal07%2Fpallavagarwal07.gitlab.io/pages/domains"
returns:
[{"domain":"varstack.com","url":"https://varstack.com","certificate":....]
Upvotes: 2
Views: 2086
Reputation: 118
I finally figured it out (although I would still classify this as a bug on the part of GitLab).
The ID needs to be url-encoded, which is why I had replaced /
in the repository name by %2F
. However the character .
should not have been a problem (-
in the former URL did not cause any problem). However, replacing .
by %2E
gives expected (correct) results.
I think this is a bug because:
.
, including the API to add new domains (which also takes domain as a form parameter, and not in URL).TL;DR
Using:
pallavagarwal07%2Fpallavagarwal07%2Egitlab%2Eio
instead of
pallavagarwal07%2Fpallavagarwal07.gitlab.io
in the URL makes it work.
Upvotes: 2