Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I retrieve commit data from git tag that has slashes via rest api

snasman October 15, 2020

Hi everyone.

 

I am trying to retrieve commit data for a tag that has slashes in the name.  

Ex tag: 

release/2020-09-23-v3.13.4

I am using the following rest GET call but getting a 404 error.

https://git.server.com/rest/api/1.0/projects/TEST/repos/test/commits/release/2020-09-23-v3.13.4

Is there a way I can properly format this call to retrieve the commit data for the tag above?

Thank you so much for your help.

1 answer

1 vote
Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2020

Encode the forward slash, dash and period characters in UTF-8 format, like:

release%2F2020%2D09%2D23%2Dv3%2E13%2E4

 

snasman October 19, 2020

Thank you for your response.

 

It still produces an error:

 

<title>HTTP Status 400 – Bad Request</title>

 

Interestingly if you trying to do a range of commits between 2 tags with the same naming scheme using params since and until.  Same commits endpoint works without any issues.  Its only a problem when I want to get commit data for one tag.  Maybe there is another call that would give me that data?

Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2020

Try referencing the commit by its ID, which is normally a SHA1 text string, like this

https://git.server.com/rest/api/1.0/projects/TEST/repos/test/commits/def0123abcdef4567abcdef8987abcdef6543abc
Like Earl McCutcheon likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events