Hi Hawk -
Could you please show us the network tab in your browser DevTools, what is shown there?
Hi Hawk -
Could you please show us the network tab in your browser DevTools, what is shown there?
Hi Illya,
I'm using some development tool to send the request from Oracle DB to Appery DB. I'm not using a browser. The message above is the response I got back from Appery DB.
How can I test it in the browser? I cannot create UPDATE service on Users collection in Appery.
I tried FireFox as follows:
Many thanks,
Hi Hawk,
Multiple update for users not allowed.
You need to use update user REST.
precode
curl -X PUT
-H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9"
-H "X-Appery-Session-Token: c6771e2f-44ae-42ea-9946-5fa320578233"
-d "{"email":"stacy@somemail.com"}"
https://api.appery.io/rest/1/db/users/54539efee4b05c4ac3b9737f
/code/pre
See details here: http://devcenter.appery.io/documentat...
Regards.
Hi Yurii,
In my last attempt, I used the following:
precontent := '{"username":"star1234","password":"star1234"}';
url:= 'https://api.appery.io/rest/1/db/users'||A_id ; /pre
Where I concatenate A_id (which is the variable contains one user _id) to the URL. So the real value is something like this:
pre 'https://api.appery.io/rest/1/db/users54539efee4b05c4ac3b9737f'/pre
So I guess I'm updating only one user. right?
In addition, I used the content:
precontent := '{"username":"star1234","password":"star1234"}';/pre
and
precontent := '{"operations":{"$set": "username":"star1234","password":"star1234"}}';/pre
and
precontent := '{"password": { "$set": "star1234"}}';/pre
And all gave me the same error in the response!
Hi Hawk,
Your code:
pre
url:= 'https://api.appery.io/rest/1/db/users'||A_id ;
/pre
Is not correct cause of there is not "/" between "users" and "userId".
Please use this one:
pre
url:= 'https://api.appery.io/rest/1/db/users/'||A_id ;
/pre
Regards.
Many thanks Yurii !
Hi Yurii,
I'm trying to update users passwords from Oracle DB. I need to use one user here to retrieve session-Token. But the problem is, this user is only allowed to update its own password. And when I use the session-Token with other users, I receive the response : does not have write permission to this object
I understand it's because of ACL value. When I add the user I'm using to that object, I can then update the password. But I need to write permission to this user for all objects (I have 2000 users), so I cannot go to acl field for each of them and update them one by one.
Is there any easier way to grant one user (e.g. admin) write permission over all users (update their ACL)?
Thanks,
Hi Hawk,
For this case you can use Master key it will allow you access objects without session token.
Please read more about it here: http://devcenter.appery.io/documentat...
Note: master-key is very sensitive information. So it's better to use it in Server code to avoid access this information to other users.
Regards.
Thanks Yurii,
Can I use Master key to delete entire collection from Oracle without using _id's values?
In fact deleting the collection object by object is taking major time for a collection of 10,000 objects.
Thanks,
Hi Hawk,
Unfortunatly, currently there is not such api in Appery DB.
But here is a solution to improve this processing speed:
Create Server script.
Populate it with following JS code:
pre
var dbId = "52fd3d06e4b0a25c11cxxx17";
var collectionName = "tempCollection";
var query = [] ;
try
{
var params = {};
params.criteria =
{
//here you can add query paremeters.
};
queryResult = Collection.query(dbId, collectionName, params);
for(var i = 0; i < queryResult.length; i++){
Collection.deleteObject(dbId, collectionName, queryResult._id);
queryResult
};
response.success({message: (queryResult.length + " items deleted")});
}
catch (e)
{
response.success("message: " + e.message + "ncode: " + e.code);
}
/pre
Also you specify in this screen needed search criteria to delete items.
Regards.