As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Login (POST)POST /alfresco/service/api/login—Login and establish a ticket.InputJSON Data Object.username cleartext usernamepassword cleartext passwordReturns the new authentication ticket.
… strUri = "http://localhost:8080/alfresco/service/api/login"; strJson = @"[""username"", ""admin"", ""password"", ""contacts""]"; // Create the Web Request Object WebRequest request = WebRequest.Create(strUri); // Specify that you want to POST data request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; if (strUri != null) { // write out the data to the web server writeToURL(request, strJson); } else { request.ContentLength = 0; } // read the response from the Web Server strHtmlContent = retrieveFromURL(request); //Das Lesen der Antwort ergibt einen Fehler …. private String retrieveFromURL(WebRequest request) { // 1. Get the Web Response Object from the request WebResponse response = request.GetResponse(); // 2. Get the Stream Object from the response Stream responseStream = response.GetResponseStream(); // 3. Create a stream reader and associate it with the stream object StreamReader reader = new StreamReader(responseStream); // 4. read the entire stream return reader.ReadToEnd(); }// end retrieveFromURL method
//anstatt strJson = @"[""username"", ""admin"", ""password"", ""contacts""]"; strJson = "{username: \"admin\", password: \"contact\"}"; //wenn contacts dein PW ist //anstatt request.ContentType = "application/x-www-form-urlencoded"; request.ContentType = "application/json";
curl http://localhost:8080/alfresco/service/api/login -H "content-type: application/json" -d "{username: \"admin\", password: \"contacts\"}"
{ "data": { "ticket":"TICKET_6c3ba5ca3b72872b7ddbe8bcde9cca86f36af08c" } }