Update document content Alfresco - ERROR POST - HELP

172 views
Skip to first unread message

Patrícia Sousa

unread,
Jan 25, 2016, 12:36:19 PM1/25/16
to Alfresco Technical Discussion

I try to make the request with http://localhost:8080/share/proxy/alfresco/api/upload with this:

function getResponse(pdfbase64) {
            var csrf_header = Alfresco.util.CSRFPolicy.getHeader();
            var csrf_token = Alfresco.util.CSRFPolicy.getToken();
            var fd = new FormData();
            if (Alfresco.util.CSRFPolicy && Alfresco.util.CSRFPolicy.isFilterEnabled())
            {
                fd.append(csrf_header, csrf_token);
                fileUpdateURL += "?" + Alfresco.util.CSRFPolicy.getParameter() + "=" + encodeURIComponent(Alfresco.util.CSRFPolicy.getToken());

            }
            fd.append("username", "admin");
            fd.append("updatenoderef", nodeRef);
            fd.append("filedata", pdfbase64);
            fd.append("majorversion", "true");
            fd.append("overwrite", "true");
            alert(fileUpdateURL);
            $.ajax({
                url: fileUpdateURL,
                type: "POST",
                data: fd,
                processData: false,  // tell jQuery not to process the data
                contentType: false   // tell jQuery not to set contentType
            });

    }


The variable pdfbase64 is the content to put on the file (the changes that I made on the file to update the file in base64), but maybe this isn't the right format?, nodeRef is the reference of the file like: "workspace://SpacesStore/4fb1b7e7-2502-4011-8870-17e8d626b93b" and fileUpdateURL is the URL to POSThttp://localhost:8080/share/proxy/alfresco/api/upload

Source of params


But I obtain the error:

{ "status" : { "code" : 400, "name" : "Bad Request", "description" : "Request sent by the client was syntactically incorrect." }, "message" : "Required parameters are missing", "exception" : "", "callstack" : [ ], "server" : "Community v5.0.0 (d r99759-b2) schema 8,022", "time" : "Jan 24, 2016 1:14:41 PM" }

Can you help me?

sujay pillai

unread,
Jan 25, 2016, 12:46:06 PM1/25/16
to alfresco-techn...@googlegroups.com

Regards,
Sujay Pillai


--
You received this message because you are subscribed to the Google Groups "Alfresco Technical Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-technical-d...@googlegroups.com.
To post to this group, send email to alfresco-techn...@googlegroups.com.
Visit this group at https://groups.google.com/group/alfresco-technical-discussion.
For more options, visit https://groups.google.com/d/optout.

Patrícia Sousa

unread,
Jan 25, 2016, 12:47:49 PM1/25/16
to Alfresco Technical Discussion
I see that, but I don't know what is my error.

Regards,
Sujay Pillai


To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-technical-discussion+unsub...@googlegroups.com.

Patrícia Sousa

unread,
Jan 25, 2016, 12:53:32 PM1/25/16
to Alfresco Technical Discussion
How can I put on the postman the "append" of my code? I don't understand :( 
Reply all
Reply to author
Forward
0 new messages