URL:
'https://${BASE_URL}/rest/api/latest/projects/~USER_COMPANY.IN/repos/figma-props/browse/test.md'
When i'm trying to update a file in a repo using this API i'm getting an error (Status code 500):
{ "errors": [ { "context": null, "message": "An error occurred while processing the request. Check the server logs for more information.", "exceptionName": null } ] }
async function commitChanges(branchName, latestCommitId) {
console.log('update file called');
const url = 'https://${BASE_URL}/rest/api/latest/projects/~USER_COMPANY.IN/repos/figma-props/browse/test.md';
const formdata = new FormData();
formdata.append('content', 'value - t1');
formdata.append('sourceBranch', branchName);
formdata.append('sourceCommitId', latestCommitId);
formdata.append('branch', branchName);
formdata.append('message', 'test.md edited online with Bitbucket');
console.log('form-->>>', formdata);
const requestOptions = {
method: 'PUT',
headers: {
Authorization: `Bearer ${token}`,
accept: 'application/json',
'content-type': 'multipart/form-data',
},
body: formdata,
};
try {
const result = await fetch(url, requestOptions);
console.log('API res-->>', result);
}
catch (error) {
console.log('error-->>>', error);
}
}
Additional Info:
I'm not calling the API from the frontend, i'm calling a backend API which is calling the update file API('https://${BASE_URL}/rest/api/latest/projects/~USER_COMPANY.IN/repos/figma-props/browse/test.md')
I've tried hitting the API from postman and there's a Cookie which is getting passed
if i remove that Cookie from the header i get the 500 ERROR
My hunch is the ERROR is because of the Cookie, but that Cookie keeps changing
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.