Hello Luiz,
I think the endpoint should be this: https://api.clarizen.com/V2.0/services/files/Upload and not uploadUrl. uploadUrl should be one of the parameters:
I hope this helps.
Roland
Hello again!
So, I solved the problem with getUploadUrl, I do have it now but now I can't POST the file to this URL. I tested it in many ways but I don't know what is not working because there is no response from Clarizen API. It is just blank. Is there a way that I can get to know how the API is receiving my request?
My code:
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(uploadUrl);
request.setMethod('POST');
request.setHeader('Authorization', getSessionId());
request.setHeader('Content-Type', 'application/octet-stream');
request.setHeader('Content-Length', String.valueof(cv.ContentSize));
request.setBody(EncodingUtil.base64Encode(cv.VersionData));
HttpResponse response = http.send(request);
Please sign in to leave a comment.
Hello Luiz,
I think the endpoint should be this: https://api.clarizen.com/V2.0/services/files/Upload and not uploadUrl. uploadUrl should be one of the parameters:
I hope this helps.
Roland
Hello Roland, thanks for reaching me out!
Yes, the final endpoint is /files/upload, but before that I have to perform two other calls:
1°) Perform "files/getUploadUrl" to get a url where I should POST my file;
2°) POST my file to that url returned by 1° step;
3°) Perform "files/upload" and provide the url returned by 1° step as "uploadUrl" parameter.
I am having problems with the 2° step because I don't know how Clarizen is processing my calls on that URL, there are no errors or success messages, its just blank and not working.
Just to clarify, the variable "uploadUrl" contains the url returned by 1° step.