php - Want to manage mongoldb user on CodeIgniter using Parse Rest API -
database: mongodb backend framework: codeigniter
want manage default user table backend. using parserestapi know mongodb not allow update user without session. there way can manage users created app , delete/create new users.
yes can parse rest api
for exmaple delete user: use delete http verb , call that:
note: need pass session token or master key
curl -x delete \ -h "x-parse-application-id: yourappid" \ -h "x-parse-rest-api-key: yourapikey" \ -h "x-parse-session-token: sessiontoken" \ -h "x-parse-master-key: yourmasterkey" \ https://api.example.com/1/users/<objectid>
in php can write:
$ch = curl_init('https://api.example.com/1/users/<objectid>'); curl_setopt($ch, curlopt_customrequest, "delete"); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, array( 'content-type: application/json', 'x-parse-application-id: yourappid', 'x-parse-rest-api-key: yourapikey', 'x-parse-master-key: yourmasterkey' ); $result = curl_exec($ch);
to create user call api (i use curl example)
curl -x post \ -h "x-parse-application-id: youappid" \ -h "x-parse-rest-api-key: yourapikey" \ -h "content-type: application/json" \ -d '{ "objectid": "", "updatedat": "", "createdat": "", "name": "john doe", "pass": "toto42" }' \ https://api.example.com/1/classes/user/
Comments
Post a Comment