Page 1 of 1

REST Service retrive user problem.

Posted: Mon Aug 18, 2014 3:08 pm
by Need Bluud

On the beginning i want to sorry for my english, it's not my native launguage, so I can make few mistakes.

I'm new to the appery.io platform, but i have some experience in programming (not specifically in JavaScript I'm still learning.)

I making app with permissions system and custom user fields, so I add some fields to user database and add new rest service using this as template http://devcenter.appery.io/documentat... i used Retrive User GET Request Everything works fine but... When i send request to API i get all users from database, in order from older to newest, not user that i want to have. I got something like this:

[
{
"id":"53f**********e9a90",
"username":"user1",
"createdAt":"2014-08-17 06:56:34.943",
"updatedAt":"2014-08-17 17:41:44.309",
"acl":{
"":{
"read":true
},
"53f***********9a90":{
"read":true,
"write":true
}
},
"admin":true,
"active":true
},
{
"id":"53f*****f5558e4",
"username":"user2",
"createdAt":"2014-08-17 17:27:13.753",
"updatedAt":"2014-08-17 17:27:30.969",
"acl":{
"":{
"read":true
},
"53f*************558e4":{
"read":true,
"write":true
}
},
"admin":false,
"active":true
}
]

Image

And if i add more user i got more parts. I send request with.

curl -X GET
-H "X-Appery-Database-Id: "
-H "X-Appery-Session-Token: "
]https://api.appery.io/rest/1/db/users...

user_id - current user id from variable
database_id - (as header) database id from generated config file
session_token - (as header) session token from variable
include - i left it empty becouse i don't know what to do with it (Maybe this is my mistake).

So my question is how to get response with only one user with specified ID?

For example if i have 50 users i want only to have request with user 25, i put he's ID and i want to got something like this

{
"id":"his ID",
"username":"user25",
"createdAt":"2014-08-17 06:56:34.943",
"_updatedAt":"2014-08-17 17:41:44.309",
"acl":{
"":{
"read":true
},
"**********************8":{
"read":true,
"write":true
}
},
"admin":true,
"active":true
},

Thank you in advance.
Best Regards


REST Service retrive user problem.

Posted: Mon Aug 18, 2014 6:24 pm
by Evgene Karachevtsev

Hello Need,

Please look at this link, it should help: http://devcenter.appery.io/documentat...


REST Service retrive user problem.

Posted: Mon Aug 18, 2014 6:48 pm
by Need Bluud

Okay, i must send request like this:

curl -X GET
-H "X-Appery-Database-Id: 526fdbd8e4b07c3286b537f1"
-H "X-Appery-Session-Token: 1cc50e70-459a-4f30-97dd-24b41ea37e18"
https://api.appery.io/rest/1/db/users...

But how to replace this part

/users/[527a2ccfe4b017bd81a8df93]

With variable that i can map in "Edit mapping" feature?


REST Service retrive user problem.

Posted: Mon Aug 18, 2014 6:49 pm
by Need Bluud

Okay, it's great tip, but please help me with next problem


REST Service retrive user problem.

Posted: Tue Aug 19, 2014 1:46 am
by Yurii Orishchuk

Hi Need,

Here is right settings for getUser settings:

1 Settings tab: http://prntscr.com/4e7lc4/direct

pre

URL: https://api.appery.io/rest/1/db/users/{userId}

/pre

2 Request tab: http://prntscr.com/4e7lzc/direct

pre

parameters:

X-Appery-Database-Id = {database_id}

X-Appery-Session-Token

userId

/pre

That's all. After you have set up this settings you will get correct result.

Also if you will have same problem please give us your service settings-request tabs screenshots.

Regards.


REST Service retrive user problem.

Posted: Tue Aug 19, 2014 6:55 am
by Need Bluud

I deal with it. Thank you for help ^ ^ . The solution is right.