Put file in repository with curl api

How to put a file on a repository with curl and API?

I can create a new file, cleared file, but I need to PUT a file created.

To create a new file I used this command:

curl -s -w -XPOST --header “Content-Type: application/json” --header “PRIVATE-TOKEN: ${GIT_PWD}” --data “@update.jsonhttps://gitlab.mycompany.com/api/v4/projects/$PROJECT_ID/repository/commits

“branch”: “main”,
“commit_message”: “Updated file”,
“actions”: [
“action”: “update”,
“file_path”: “a.json”,
“content”: “a.json”

But a file “a.json” have just the content “a.json”.

Hi @tandrade

curl --request POST \
     --form "branch=master" \
     --form "commit_message=some commit message" \
     --form "start_branch=master" \
     --form "actions[][action]=create" \
     --form "actions[][file_path]=foo/bar" \
     --form "actions[][content]=</path/to/local.file" \
     --form "actions[][action]=delete" \
     --form "actions[][file_path]=foo/bar2" \
     --form "actions[][action]=move" \
     --form "actions[][file_path]=foo/bar3" \
     --form "actions[][previous_path]=foo/bar4" \
     --form "actions[][content]=</path/to/local1.file" \
     --form "actions[][action]=update" \
     --form "actions[][file_path]=foo/bar5" \
     --form "actions[][content]=</path/to/local2.file" \
     --form "actions[][action]=chmod" \
     --form "actions[][file_path]=foo/bar5" \
     --form "actions[][execute_filemode]=true" \
     --header "PRIVATE-TOKEN: <your_access_token>" \