Delete Collection

POST {{baseUrl}}/{{organization}}/{{project}}/_apis/git/repositories/{{repositoryId}}/pushes?api-version=6.0

This request deletes a collection with collectionContent in the repositoryId in the given organization and project under the name collectionName. This request also updates the variable {{Repository Name}}/{{Branch Name}}/collectionDeleted to Deleted.

This request also uses the variable baseRepo as part of the request URL to push the collection to the repository. The baseRepo variable allows the switching of this request from a regular POST request (which would use https://dev.azure.com) to an example generated through the Mock Server (which would use the Mock Server URL).

Request Params

KeyDatatypeRequiredDescription
api-versionstring

Request Body

{"refUpdates"=>[{"name"=>"{{branch}}", "oldObjectId"=>"{{previousCommitId}}"}], "commits"=>[{"comment"=>"Deleted {{fileName}}.", "changes"=>[{"changeType"=>"delete", "item"=>{"path"=>"/{{directoryName}}/{{fileName}}.json"}}]}]}

HEADERS

KeyDatatypeRequiredDescription
x-mock-response-namestring

RESPONSES

status: Created

{"commits":[{"treeId":"a00aaa0000a00a00aa0000aa0aa000000aa00a0a","commitId":"0aa000aaaa00000aa000aaa0a00a0000a00000aa","author":{"name":"Person","email":"person@gmail.com","date":"2021-00-00T00:00:00Z"},"committer":{"name":"Person","email":"person@gmail.com","date":"2021-00-00T00:00:00Z"},"comment":"Deleted {{repositoryId}}.","parents":["000000000aa0000aa0aaaa000a00a0a00000a000"],"url":"https://dev.azure.com/{{organization}}/{{projectId}}/_apis/git/repositories/0aaaa0a0-a000-00a0-0000-a00a0000a0000/commits/0aa000aaaa00000aa000aaa0a00a0000a00000aa"}],"refUpdates":[{"repositoryId":"0aaaa0a0-a000-00a0-0000-a00a0000a0000","name":"refs/heads/main","oldObjectId":"000000000aa0000aa0aaaa000a00a0a00000a000","newObjectId":"0aa000aaaa00000aa000aaa0a00a0000a00000aa"}],"repository":{"id":"0aaaa0a0-a000-00a0-0000-a00a0000a0000","name":"{{repositoryId}}","url":"https://dev.azure.com/{{organization}}/{{projectId}}/_apis/git/repositories/0aaaa0a0-a000-00a0-0000-a00a0000a0000","project":{"id":"{{projectId}}","name":"{{project}}","url":"https://dev.azure.com/{{organization}}/_apis/projects/{{projectId}}","state":"wellFormed","revision":11,"visibility":"private","lastUpdateTime":"2021-00-00T00:00:00.00Z"},"size":730,"remoteUrl":"https://{{organization}}@dev.azure.com/{{organization}}/Postman/_git/{{repositoryId}}","sshUrl":"git@ssh.dev.azure.com:v3/{{organization}}/{{project}}/{{repositoryId}}","webUrl":"https://dev.azure.com/{{organization}}/{{project}}/_git/{{repositoryId}}","isDisabled":false},"pushedBy":{"displayName":"Person","url":"https://spsprodcus5.vssps.visualstudio.com/a0a0000a0-0aaa-00aa-a000-a00000a000aa/_apis/Identities/aa0a0a00-0a00-000a-a0aa-0000a0a0000a","_links":{"avatar":{"href":"https://dev.azure.com/{{organization}}/_apis/GraphProfile/MemberAvatars/aaa.AAAaAaAaAAAaA0A0AA00AaAaAAA0AAAaAaA0AaA0AAAaAAAa"}},"id":"aa0a0a00-0a00-000a-a0aa-0000a0a0000a","uniqueName":"person.com","imageUrl":"https://dev.azure.com/{{organization}}/_api/_common/identityImage?id=aa0a0a00-0a00-000a-a0aa-0000a0a0000a","descriptor":"aaa.AAAaAaAaAAAaA0A0AA00AaAaAAA0AAAaAaA0AaA0AAAaAAAa"},"pushId":6,"date":"2021-00-00T00:00:00.00000Z","url":"https://dev.azure.com/{{organization}}/{{project}}/_apis/git/repositories/0aaaa0a0-a000-00a0-0000-a00a0000a0000/pushes/6","_links":{"self":{"href":"https://dev.azure.com/{{organization}}/{{projectId}}/_apis/git/repositories/0aaaa0a0-a000-00a0-0000-a00a0000a0000/pushes/6"},"repository":{"href":"https://dev.azure.com/{{organization}}/{{projectId}}/_apis/git/repositories/0aaaa0a0-a000-00a0-0000-a00a0000a0000"},"commits":{"href":"https://dev.azure.com/{{organization}}/{{projectId}}/_apis/git/repositories/0aaaa0a0-a000-00a0-0000-a00a0000a0000/pushes/6/commits"},"pusher":{"href":"https://spsprodcus5.vssps.visualstudio.com/a0a0000a0-0aaa-00aa-a000-a00000a000aa/_apis/Identities/aa0a0a00-0a00-000a-a0aa-0000a0a0000a"},"refs":{"href":"https://dev.azure.com/{{organization}}/{{projectId}}/_apis/git/repositories/0aaaa0a0-a000-00a0-0000-a00a0000a0000/refs/heads/main"}}}