This post is part of the series on PowerShell Snippets.
While looking into uploading a release asset to a GitHub release, I discovered that to do this I needed the internal numeric id for a release and not just the id I’d given it. The element I needed from the GitHub json was id which can be retrieved using the below PowerShell which executes curl and then selects a single element:
$ghAuthorizationToken = "ghp_authorizationtoken"
$ghUser="username"
$ghRepo="repositoryname"
$ghTag="v1.4.2"
$URL= "https://api.github.com/repos/$ghUser/$ghRepo/releases/tags/$ghTag"
$Json=(curl.exe $URL)|ConvertFrom-json
$id=$Json| Select id
Click to show/hide the PowerShell Snippets Series Index
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.