As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
I wanted to use my hosted server accessing Kinveys backend service by PHP. REST API access is a general usage type so I didn't expect some specific explanation.
I started from scratch and want to give to anyone in the same situation all the information you need to access Kinvey's backend service by REST API and PHP.
The key to use REST API by PHP is the powerful command cURL and therefore supported in PHP. There are many commands but you need only a few for any CRUD operations.
Use these samples to complete your code. Something in red means you have to replace the red part by your own credentials. The example expects you are already registered and have access to Kinvey's backend console. Make also sure that the user has the required permission for the specific CRUD operation.
In the end you will find some very important notes you have to consider working wit cURL/Kinvey's backend service.
This action is equal to a INSERT statement. You can do the same on any other collection than the mentioned user collection here.
Query collection
// Define query as JSON object $query = '{"username":"nametofind"};
// Check if start is too close (< 10m) to any other game start $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, 'https://baas.kinvey.com/appdata/yourAppKey/CollectionToSearchIn/?query='.$query.'&tls=true');
Consider that a search result can consist of more than one record. Each found record will be stored in the array $result.
&tls=true: this is optional, enforcing secure transfer (HTTPS)
Working with queries:
Since the query is defined in a JSON object: DON'T use single quotes (') but use double quotes ("). Otherwise the return ($result) is just empty or in best case you get an error message.
DON'T use (white) spaces in queries. This will lead into an error message or no returned result (this may differ in other Kinvey APIs)
Thanks for posting this. Indeed, this information is going to be really helpful to everyone exploring Kinvey using REST API and PHP. We appreciate your efforts.
Thanks,
Pranav
Kinvey
T
Tayger
said
almost 5 years ago
Hope I can help others with it. Sadly the lower part is cut off.
Tayger
I wanted to use my hosted server accessing Kinveys backend service by PHP. REST API access is a general usage type so I didn't expect some specific explanation.
I started from scratch and want to give to anyone in the same situation all the information you need to access Kinvey's backend service by REST API and PHP.
The key to use REST API by PHP is the powerful command cURL and therefore supported in PHP. There are many commands but you need only a few for any CRUD operations.
Use these samples to complete your code. Something in red means you have to replace the red part by your own credentials. The example expects you are already registered and have access to Kinvey's backend console. Make also sure that the user has the required permission for the specific CRUD operation.
In the end you will find some very important notes you have to consider working wit cURL/Kinvey's backend service.
Handshake to test proper connection
You always need the curl_init() command before doing a cURL operation. You should close it by curl_close() in the end.
Login with AppKey user
Create/register new user in backend service
This action is equal to a INSERT statement. You can do the same on any other collection than the mentioned user collection here.
Query collection
Consider that a search result can consist of more than one record. Each found record will be stored in the array $result.
&tls=true: this is optional, enforcing secure transfer (HTTPS)
Working with queries:
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstPranav J
Tayger,
Thanks for posting this. Indeed, this information is going to be really helpful to everyone exploring Kinvey using REST API and PHP. We appreciate your efforts.
Thanks,
Pranav
Kinvey
Tayger
Hope I can help others with it. Sadly the lower part is cut off.
Regards