person.put

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2013 04:45 PM
Hello everybody,
there is an issue related to this javascript that I may not have understood.
In my service when I call the PUT functionallity I receive HTTP code 200. Which is okay. But instead of having my user updated, I receive a json with the admin values plus my user is not being updated.
I am pretty sure I am doing everything okay.
Does any one know any problem with this person.put or maybe a json pattern that I may not be following?
there is an issue related to this javascript that I may not have understood.
In my service when I call the PUT functionallity I receive HTTP code 200. Which is okay. But instead of having my user updated, I receive a json with the admin values plus my user is not being updated.
I am pretty sure I am doing everything okay.
Does any one know any problem with this person.put or maybe a json pattern that I may not be following?
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2013 12:55 AM
which person webscript you are using?
Have you checked the expected input json format? as when you will be changing to PUT there is altogether different webscript will be called.
Have you checked the expected input json format? as when you will be changing to PUT there is altogether different webscript will be called.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2013 11:17 AM
Thanks for the reply.
Yes I checked the expected JSON. This part is ok. I am using Fiddler to test my service and I get a 200 HTTP code with a JSON containing the Admin values. Even if I use a PUT into another user, I get the Admin values.
I am using this webscript: http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Update_Person
Yes I checked the expected JSON. This part is ok. I am using Fiddler to test my service and I get a 200 HTTP code with a JSON containing the Admin values. Even if I use a PUT into another user, I get the Admin values.
I am using this webscript: http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Update_Person
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2013 05:25 AM
there maybe something wrong with your code ,following is my test code ,it works fine.
please paste your code here .
package com.kayne.local.java.webscripts;import org.apache.commons.httpclient.HttpClient;import org.apache.commons.httpclient.HttpStatus;import org.apache.commons.httpclient.UsernamePasswordCredentials;import org.apache.commons.httpclient.auth.AuthScope;import org.apache.commons.httpclient.methods.PutMethod;import org.apache.commons.httpclient.methods.StringRequestEntity;import org.json.JSONObject;public class UpdatePersonTest { public static void main(String[] args) { HttpClient client = new HttpClient(); client.getState().setCredentials( new AuthScope("localhost", 8080, "Alfresco"), new UsernamePasswordCredentials("admin", "admin")); String userName = "kayne"; String apiurl = "http://localhost:8080/alfresco/service/api/people/'+userName; PutMethod put = new PutMethod(apiurl); try { JSONObject person = new JSONObject(); person.put("firstName", "kayne"); person.put("lastName", "zhang"); person.put("mobile", "12343424342"); person.put("location", "N.A"); System.out.println(person.toString()); put.setDoAuthentication(true); put.setRequestHeader("Content-Type", "application/json"); put.setRequestEntity(new StringRequestEntity(person.toString(), "application/json", "UTF-8")); int status = client.executeMethod(put); if (status != HttpStatus.SC_OK) { System.err.println("Method failed: " + put.getStatusLine()); } String resultString = put.getResponseBodyAsString(); System.out.println(resultString); } catch (Exception e) { e.printStackTrace(); } finally { put.releaseConnection(); } }}
please paste your code here .
