AnsweredAssumed Answered

StatusCode 404(Not Found) on File Upload using Alfresco ReST api

Question asked by jeevitha_balu on Jul 18, 2014
Latest reply on Jul 26, 2014 by kaynezhang

I'm trying to upload a file to alfresco repository using ReST api. It succeeds on using POSTMAN Rest Client but somehow fails with Error 404 (Not Found) with the following code.

Could someone please let me know what am I doing wrong?

.Net Snippet:
            string folderURL = @"http://localhost:8080/alfresco/service/api/upload?alf_ticket=(ticket# goes here)";
            string filedata = @"C:\Test\TestJeevitha2.pdf";
            Stream fileStream = new FileStream(filedata, FileMode.Open, FileAccess.Read);
            HttpContent fileContent = new StreamContent(fileStream);
            HttpContent destinationContent = new StringContent("workspace://SpacesStore/7f4fee0e-ea6c-4606-8626-346f63a78790");
            HttpContent decsContent = new StringContent("a test upload");

            var client = new HttpClient();
            var formData = new MultipartFormDataContent();
                var response = client.PostAsync(folderURL, formData).Result;
                Label1.Text = response.StatusCode.ToString(); // The status code is 404.Not Found
                return response.Content.ReadAsStreamAsync().Result;
I have been breaking my head on what went wrong for the past one day tried several methods to pass parameters to post. Note: It works in POSTMAN perfectly and able to get the JSON response back.Can someone help?

Thanks in advance.