Skip to content

Post multiple files using the REST API #38965

Discussion options

You must be logged in to vote

... with a single REST (or otherwise) call?

With GraphQL API you could use Mutation.createCommitOnBranch.

the contents need to be base64, see the Docs for more informations.

example - array with two additions

mutation {
  createCommitOnBranch(input: {fileChanges: {additions: [{path: "README.txt", contents: "dGVzdA=="}, {path: "README2.txt", contents: "dGVzdDI="}]}, branch: {repositoryNameWithOwner: "LangLangBart/test", branchName: "main"}, expectedHeadOid: "04d06edc5e7a838bcf8e868fae37a2ea7c0f3588", message: {headline: "test headline", body: "test body"}}) {
    commit {
      abbreviatedOid
    }
  }
}
{
  "data": {
    "createCommitOnBranch": {
      

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Stwissel
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API and Webhooks Discussions and conversations related to APIs or Webhooks Question inactive This discussion has been automatically marked as inactive. This was formerly labeled stale.
2 participants