I'm glad that PUT works for you, but there must be something wrong because
POST should work for entity creation, and it works for me on my local
Usergrid installs. I wonder if Tomcat 8 could be causing some bug?  I
normally run on Tomcat 7.

Dave


On Thu, Dec 3, 2015 at 8:14 AM Thành Vũ Trung <[email protected]>
wrote:

> Hi Dave,
> Thank you very much for your response.
> I could post to login or create entity relationship. I think have some
> issue when parse json body request with POST method. I tried use PUT
> instead POST, It's ok but I don't know why I request PUT method but json
> response give action "post". Example:
> Request:
> curl -X PUT
> https://v2t.mobi/p/api/v2tmultimedia/sandbox/users?access_token=YWMt7E9bNJg8EeWh7dcfIHBYKgAAAByeH_4DcQ5PXQVc2iunGEAOY0FSaqaI33A
> -d {"username":"demo1","name":"Demo1","email":"[email protected]
> ","password":"Demo@123"}
> Response:
> {
>   "action": "post",
>   "application": "ef0c8c4a-9682-11e5-b08f-a1b8a4165e37",
>   "params": {
>     "access_token": [
>       "YWMt7E9bNJg8EeWh7dcfIHBYKgAAAByeH_4DcQ5PXQVc2iunGEAOY0FSaqaI33A"
>     ]
>   },
>   "path": "/users",
>   "uri": "https://v2t.mobi/p/api/v2tmultimedia/sandbox/users";,
>   "entities": [
>     {
>       "uuid": "b712d99a-99be-11e5-a29d-61a32e280a61",
>       "type": "user",
>       "name": "Demo1",
>       "created": 1449148009897,
>       "modified": 1449148009897,
>       "username": "demo1",
>       "email": "demo1@ example.com",
>       "activated": true,
>       "picture": "
> http://www.gravatar.com/avatar/9092b49d86669ec8530d298792bc0ecb";,
>       "metadata": {
>         "path": "/users/b712d99a-99be-11e5-a29d-61a32e280a61",
>         "sets": {
>           "rolenames": "/users/b712d99a-99be-11e5-a29d-61a32e280a61/roles",
>           "permissions":
> "/users/b712d99a-99be-11e5-a29d-61a32e280a61/permissions"
>         },
>         "collections": {
>           "activities":
> "/users/b712d99a-99be-11e5-a29d-61a32e280a61/activities",
>           "devices": "/users/b712d99a-99be-11e5-a29d-61a32e280a61/devices",
>           "feed": "/users/b712d99a-99be-11e5-a29d-61a32e280a61/feed",
>           "groups": "/users/b712d99a-99be-11e5-a29d-61a32e280a61/groups",
>           "roles": "/users/b712d99a-99be-11e5-a29d-61a32e280a61/roles",
>           "following":
> "/users/b712d99a-99be-11e5-a29d-61a32e280a61/following",
>           "followers":
> "/users/b712d99a-99be-11e5-a29d-61a32e280a61/followers"
>         }
>       }
>     }
>   ],
>   "timestamp": 1449148009878,
>   "duration": 301,
>   "organization": "v2tmultimedia",
>   "applicationName": "sandbox"
> }
>
> I build usergrid follow bellow step:
> 1. wget http://mirrors.viethosting.vn/apache/usergrid/usergrid-1/v1.0.2
> 2. tar xvf apache-usergrid-1.0.2-incubating.tar.gz
> 3. cd apache-usergrid-1.0.2-incubating
> 4. cd stack
> 5. mvn clean install
> then deploy to tomcat 8 server.
>
>
> On Thu, Dec 3, 2015 at 7:22 PM, Dave <[email protected]> wrote:
>
>> Hi Thanh,
>>
>> That curl request looks good and I don't understand why it is failing.
>> Have you been able to post other data to your Usergrid installation?
>>
>> How did you obtain and build Usergrid?
>>
>> Dave
>>
>> On Tue, Dec 1, 2015 at 11:40 AM Thành Vũ Trung <[email protected]>
>> wrote:
>>
>>> Hi all,
>>> Why I could not create new user or new custom entity by POST request? I
>>> used to PUT method, It's ok.
>>> Example:
>>> + Request: curl -X POST
>>> https://localhost:8080/v2tmultimedia/sandbox/users?access_token=YWTt7E9sAJg8EeWh7dcfIHBYKgAAAVGCH_4DcQ5PXQVc2iunGEAOY0FSaqaI33A
>>> -d '{"username":"demo1","name":"Demo1","email":"[email protected]
>>> ","password":"Demo_123"}'
>>> + Response error:
>>> "error":"unrecognized_property","timestamp":1448987542574,"duration":1,"exception":"org.codehaus.jackson.map.exc.UnrecognizedPropertyException","error_description":"Unrecognized
>>> field \"username\" (Class com.sun.jersey.core.provider.EntityHolder), not
>>> marked as ignorable\n at [Source:
>>> org.apache.usergrid.rest.filters.MeteringFilter$InputStreamAdapter@7d584fe4;
>>> line: 1, column: 14] (through reference chain:
>>> com.sun.jersey.core.provider.EntityHolder[\"username\"])"}
>>>
>>>
>>> I deploy usergrid 1.0.2 on Ubuntu 14.04, jdk 8, tomcat 8.0.29
>>>
>>> Hope you can help me resolve this issue. Thank you very much.
>>> --
>>>
>>> *---------------------------------------------------------------------------------------------*
>>> *Thanh Vu*
>>>
>>> *Information Technology Engineer*
>>> *Mobile:* +84903298791
>>> *Skype:* v2t_nd |* Email:* maito:[email protected]
>>>
>>>
>
>
> --
>
> *---------------------------------------------------------------------------------------------*
> *Thanh Vu*
>
> *Information Technology Engineer*
> *Mobile:* +84903298791
> *Skype:* v2t_nd |* Email:* maito:[email protected]
>
>

Reply via email to