I want to upload zip file to my repository GitHub.
How can i make this methods API and PHP+CURL?
I tried to find the description in the documentation, but I did not find how to send the file
Related
We recently migrated from Bitbucket to ADO and one of our platforms requires a link that will return the raw file for its deployment process. Bitbucket has a "raw" link available when viewing source files in the web UI, but I haven't found anything like that in ADO, the closest thing is a download link, but I need a link that just simply returns/displays the raw source file contents, not with a download dialog box. Is this possible?
I found that using the following in the api URL got me what I need:
_apis/sourceProviders/TfsGit
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/source-providers/get-file-contents?view=azure-devops-rest-5.0
I am looking for a way to enable users of my website to upload a file from my website to their GitHub repro. Is it possible?
I want them to be able to avoid the process of downloading and asking them to go to their GitHub project and upload it directly.
The visual studio online rest api has a rest call to download the contents of a file in a TFVC repository. I want to download the latest version of all my TFVC repositories to have an on-premise back-up of all our projects.
This APi works great except for one type of file: web.config. When I want to download the web.config file I get a 404 statuscode. All other filetypes (also log4net.config and web.release.config) download correctly and I also get a 202 there. I have the correct permission to download the file and the file also exist.
I use the api as documented here: https://www.visualstudio.com/integrate/api/tfvc/items#Getafile
As you can see the path to the file in the repository is part of the URL. I think with this syntax, Visual Studio Online default security comes in way of files like web.config. In e.g. IIS the download of a web.config file is also disabled. For our git repositories this is no problem because that api doesn't include the path to the file in the url but as parameter of the url.
Is there a way around this? An undocumented feature?
When I see this documentation https://www.visualstudio.com/integrate/api/tfvc/items#Getaspecificversion it mentions:
You can indicate which version to get when you get a file, zip a folder, or get item metadata.
That zip a folder part is not (yet) documented. Does anybody of you know how to call that part of the api? That would also be a workaround for me.
This is now possible when you use the path as query parameter
This format should be used for certain files (like web.config) that are not accessible by using the path as part of the URL due to the default ASP .NET protection. The response is a stream (application/octet-stream) that contains the contents of the file.
http://fabrikam-fiber-inc.visualstudio.com/defaultcollection/_apis/tfvc/items?path=$/fabrikam-fiber-tfvc/website/website/web.config&api-version={version}
The above quote is from the documentation after this is added: https://www.visualstudio.com/integrate/api/tfvc/items#Getafile.
I wan to start a Google Transit project (a city transport feed for google maps) and for the purpose of collaboration I want to use GitHub. Now one great thing is that GitHub is offering a ZIP file download that contains all your repository, and Google wants a ZIP with a required data, but that file should have name: google_transit.zip.
So my question is:
Can I somehow give Google a link that will give it a file called google_transit.zip, that will contain all the stuff that's in the master branch? Maybe this can be done with standard "download zip" option or with some hooks or something elseā¦
GitHub will allow you to automatically download a Zip archive of the latest version of a branch using the following url:
https://github.com/:user/:repository/zipball/:branch [GET]
The archive will be given a special name following the git describe command output.
However, there's one way to achieve what you're after by leveraging the GitHub Repo Downloads API.
Every time your master branch is ready to be published, you'd execute the following steps:
If the download resource google_transit.zip already exists, remove it
Create a new download resource and name it google_transit.zip
Upload the latest zip archive using the provided information of the previous request
There's even a Ruby library (ruby-net-github-upload) that may help you automating this task.
Is there a way to override the file in the Downloads section on GitHub when uploading a file with the same filename? (e.g. via developer API or the ruby script, etc) The reason is that I want to keep track of the number of downloads. Thanks!
I havn't tried this but it's possible that you could replace the file on Amazon S3. I don't know if it will work or if it's a one-time upload token you get without the posibility to delete the file.
See the API documentation for uploading a file on Github (which includes using the amazon s3 rest api to upload the file):
http://developer.github.com/v3/repos/downloads/
And API documentation for deleing a file on amazon s3:
http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectDELETE.html
And API documentation for putting a file on amazon s3:
http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html