I need to use the Gitlab API to send a PUT-request with curl (v.7.35.0) that holds some key=value
parameters. Key content
needs to be a binary file content. So I need to send it as base64, but I already fail before. However the big file content 1.2MB is the reason why I have to use stdin as curl with other syntax was complaining of too large URI / argument lists.
Took some input from https://unix.stackexchange.com/questions/174350/curl-argument-list-too-long . But still a bit lost with the combination of arguments in curl.
DATA="{
\"author_email\": \"autoupdate-geoip@company.com\",
\"author_name\": \"Autoupdater GeoIp\",
\"branch\": \"${BRANCH_NAME}\",
\"content\": \"this-should-be-file-content-of-GeoIP.dat\",
\"commit_message\": \"Update GeoIP database\"
\"encoding\": \"base64\"
}"
curl -X PUT -G "${GEOIP_URL}" \
--header "PRIVATE-TOKEN: ${TOKEN}" \
--header "Content-Type: application/json" \
--data-urlencode @- <<EOF
"${DATA}"
EOF
Common alternatives to curl would also work for me.