I am trying to edit existing file in a repo using gitlab v4 api, When I tried to edit file using postman rest client it executes without any issue, 200 status returned. When I tried the same with SpringBoot RestTemplate, I am always ending up with 400 bad request error. I am completely dont know what actually happening. Rest URL : https://domainname/api/v4/projects/51/repository/files/src%2Fmain%2Fresources%2Fapplication.yml
Request object printed using LOG is :
[branch=master, content=server:port: value, commit_message=port number updated, file_path=src%2Fmain%2Fresources%2Fapplication.yml]
resttemplate API call,
HttpEntity<?> entity = new HttpEntity<Object>(request, header);
restTemplate.exchange(gitlabApiUrl, HttpMethod.PUT, entity, Object.class);
When I tried the same request body with postman, Im getting 200 success
This is the rest end point, https://domainname/api/v4/projects/:projectId/repository/files/:file_path
Does anyone have any idea what is happening.
Reference doc : https://docs.gitlab.com/ee/api/repository_files.html#update-existing-file-in-repository