Start a new topic

php CRUD operations

How or where i can to find documentations and examples for to do CRUD operations from php?

I have for example one collection called ToDos. I need to create one record in this collection. Where i can to find one example for to do this? 

I im reading this but really i don't know how apply this to php.

I have this example but i don't know how for example add create option of my ToDos Collection:


//tip: user a user account you created in kenvey admin panel.

//will make things easy when displaying the files later.

    $username = "kid_xxxx";

 $password = "c8xxxxx";

//set the endpoint in curl_init after

        $ch = curl_init("");


//You need to send the appropriate header and use base64_encode function to scrable username and password

        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Authorization: Basic ".base64_encode($username . ":" . $password),"X-Kinvey-API-Version: 3"));

//cURL after we send something give us a reply.

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

//curl_exec opens the curl connection, grabs the info and saves it in $result2 variable

        $result2 = curl_exec($ch);

//Kinvey sends back JSON and it needs to be decoded using json_decode function in php..more fun functions listed on

        $result2 = json_decode($result2, true);

//it's a good practice to close what you open.


//let's dump what we got back from Kinvey on to page


        //echo $result2;



Edgar mejia

1 Comment

Hello Edgar:

You can find a listing of our CRUD style-operations in our rest API guide

As an example, here's how a call to postman looks to add a collection for instance:



X-Kinvey-API-Version: 3

Content-Type: application/json

Authorization : Authorization code (appkey and mastersecret)

Post Body: {}

This same call is changed to include an id (/collectionName/id(unique) ) 

And then instead of {} you would pass in a valid json document.

Does that help?


Login or Signup to post a comment