Posts

Parse.com Retrieving Objects Using PHP CURL

If you have already created and object, you can retrieve its records by sending a GET request to the object URL.

For this tutorial I will assume that you already have an Parse.com account. Follow the below mentioned steps to get an Application Id ans REST API key:

  1. Sign In to Parse.com
  2. Move to Dashobard
  3. Create a New App
  4. Copy Application ID, Client Key and REST API Key

The code below will send a PHP CURL GET request to REST API of Parse.  You have to place you Application ID and REST API Key with the placeholders. You can run this code on a PHP server

The response body is a JSON object containing all the user-provided fields, plus the createdAt, updatedAt, and objectId fields. A sample response body is shown below:

If the object you are retrieving have pointers to children,  then you can fetch child objects by using the include option. For example, to fetch the object pointed to by the “game” key:

 

Parse.com Create New Object Using PHP CURL

Parse.com is an external BaaS (Backend as a service) provider.

Parse.com provides REST API that lets you interact with Parse.com from anything that can send an HTTP request. In this tutorial we will send and HTTP request to Parse.com using PHP CURL.

This tutorial assumes that you have Parse.com account. Follow the below mentioned steps to create a Parse.com App and obtain Application Id.

  1. Sign In to Parse.com
  2. Move to Dashobard
  3. Create a New App
  4. Copy Application ID, Client Key and REST API Key

The code below will send a PHP CURL request to REST API of Parse. To create a new object on Parse, send a POST request to the class URL containing the contents of the object. You have to place you Application ID and REST API Key with the placeholders. You can run this code on a PHP server.

When the creation is successful, the HTTP response is a 201 Created and the Location header contains the object URL for the new object:

The response body is a JSON object containing the objectId and the createdAt timestamp of the newly-created object: