NAV Navbar

Back4Press

cURL JavaScript Android Swift Objective-C PHP .NET

Introduction

The Back4Press API Documentation provides an easy way to connect your App to Back4App and use all the backend resources provided by Back4App Platform.

The API closely follows REST semantics, uses JSON to encode objects, relies on standard HTTP codes to signal operation outcomes and are mostly generated through Parse Server.

The API documentation below is specifically generated for your app Back4Press by Back4App Platform. If you make changes to your app's backend schema (using Parse Server Dashboard, Back4App CLI or even these APIs), the API interface for those fields will change correspondingly, and those changes will be reflected here.

Getting Started

Since these are RESTful APIs, you are free to use your preferred technology to perform HTTP requests according to this documentation. Although we highly encourage you to use them through one of the Parse SDKs for a faster and better development experience. Please find below how to install each of the supported SDKs.

Installing Parse SDK

There is not a specific Parse SDK for cURL and you just need to make sure that cURL is installed in your machine. Most of the Operational Systems bring cURL installed by default, but you can also download the latest version of it in cURL Official Web-Site.

Install Parse JavaScript SDK npm module:

npm install parse

You do not need to install nor initialize JavaScript SDK when creating Cloud Code Functions since it is installed and initialized by default.

In order to install the Parse-SDK-Android as a Gradle dependency, add this in your root build.gradle file (not your module build.gradle file!)

allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}

And in your module build.gradle file, add the following:

dependencies {
    ...
    implementation "com.github.parse-community.Parse-SDK-Android:parse:1.18.5"
}

Notice that the version of Parse-SDK-Android was 1.18.5 when this documentation was released. To find the latest version, check here.

There are a plenty of ways to install Parse SDK:

Option 1: Using Carthage. Add the following line to your Cartfile:

github "parse-community/Parse-SDK-iOS-OSX"
github "parse-community/Parse-SDK-iOS-OSX"

Run carthage update and it should be installed in your Carthage folder.

Option 2: Using CocoaPods. Add the following line to your Podfile:

pod 'Parse'
pod 'Parse'

Run pod install and open the generated .xcworkspace on Xcode, in order to avoid the linker error.

Option 3: Downloading the latest build here.

Option 4: Cloning the project and compiling manually:

git clone https://github.com/parse-community/Parse-SDK-iOS-OSX.git
cd ./Parse-SDK-iOS-OSX

# To pull in extra dependencies (Bolts and OCMock)
git submodule update --init --recursive

# To install all the gems
bundle install

# Build & Package the Frameworks
rake package:frameworks
git clone https://github.com/parse-community/Parse-SDK-iOS-OSX.git
cd ./Parse-SDK-iOS-OSX

# To pull in extra dependencies (Bolts and OCMock)
git submodule update --init --recursive

# To install all the gems
bundle install

# Build & Package the Frameworks
rake package:frameworks

Follow these instructions below to install .NET + Xamarin SDK usign NuGet Package

// Using Package Manager
Install-Package parse -Version 1.7.0

// Using .NET CLI
dotnet add package parse --version 1.7.0

Or install a specific release from SDK repository

SDK requires Visual Studio 2012 or Xamarin Studio and targets .NET 4.5 applications, Windows Store apps, Windows Phone 8 apps, and Xamarin.iOS 6.3+ or Xamarin.Android 4.7+ apps.

In order to Parse-SDK work properly, make sure you have at least PHP 5.4 or HHVM 3.0 installed.

Installing with Composer: Create a composer.json file in your project root folder, and add the following:

{
  "require": {
    "parse/php-sdk" : "1.4.*"
  }
}

Run the following command on your terminal to install the Parse-SDK and setup the autoloader:

composer install

And then require the autoloader on your PHP script to automatically load the Parse SDK classes:

require 'vendor/autoload.php';

Installing with Git: Clone the Parse-SDK repository using your terminal:

git clone https://github.com/parse-community/parse-php-sdk.git

And then require the autoloader in your PHP script to automatically load the Parse SDK classes:

require 'autoload.php';

Please choose below one of the Parse SDKs and learn how to install it using the instructions that you can find in the right panel of this documentation.

It is not necessary to install any Parse SDK to call the API using cURL commands. To make sure that cURL is available at your machine, open a terminal window and execute a simple cURL command. If you do not have cURL available or want to use an updated version please visit their official website.

Installing JavaScript SDK

Installing Android SDK

Installing iOS SDK (Swift)

Installing iOS SDK (Objective-C)

Installing PHP SDK

Installing .NET SDK

Initializing Parse SDK

You do not need to do any kind of initialization when using cURL but you must send your app's credentials in the headers of all requests that you'll do. Example:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/serverInfo

You should not use the REST API Key in client apps. If you need to send a RETS API directly from your client-side code, you must use the Parse Client Key for your currently client-side platform (e.g. Client Key for iOS/Android, or .NET Key for Windows/Xamarin/Unity).

In a Node.js project:

const Parse = require('parse/node');

Parse.serverURL = 'https://parseapi.back4app.com'; // This is your Server URL
Parse.initialize(
  'BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f', // This is your Application ID
  '4wPYRKbpTJeCdmFNaS31AiQZ8344aaYubk6Uo8VW', // This is your Javascript key
  '5AVAtvlGlG5cEeolatkFDhY5p99PzoBUvm7MBLMo' // This is your Master key (never use it in the frontend)
);

In an Ionic project:

const Parse = require('parse');

Parse.serverURL = 'https://parseapi.back4app.com'; // This is your Server URL
Parse.initialize(
  'BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f', // This is your Application ID
  '4wPYRKbpTJeCdmFNaS31AiQZ8344aaYubk6Uo8VW' // This is your Javascript key
);

In a React Native project:

const { AsyncStorage } = require('react-native');
const Parse = require('parse/react-native');

Parse.setAsyncStorage(AsyncStorage);
Parse.serverURL = 'https://parseapi.back4app.com'; // This is your Server URL
Parse.initialize(
  'BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f', // This is your Application ID
  '4wPYRKbpTJeCdmFNaS31AiQZ8344aaYubk6Uo8VW' // This is your Javascript key
);

In a Web Browser (React, Angular, Vue, etc) project:

<script src="node_modules/parse/dist/parse.min.js"></script>

<script>
Parse.serverURL = 'https://parseapi.back4app.com'; // This is your Server URL
Parse.initialize(
  'BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f', // This is your Application ID
  '4wPYRKbpTJeCdmFNaS31AiQZ8344aaYubk6Uo8VW' // This is your Javascript key
);
</script>

First of all, you need to allow your application to have access to the internet and define its name. In your AndroidManifest.xml file, add the following:

<manifest
  ...
  >
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />
</manifest>

In your Application class, initialize the Parse SDK with your Parse application ID, client key, and server:

package <YOUR_PACKAGE_NAME>;

import com.parse.Parse;
import android.app.Application;

public class YOUR_ANDROID_APPLICATION extends Application {

  // Initializes Parse SDK as soon as the application is created
  @Override
  public void onCreate() {
    super.onCreate();

    Parse.initialize(new Parse.Configuration.Builder(this)
      .applicationId("BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f")
      .clientKey("rWFPEbTs7UzkaVsIXnQ4qmmr9oWqwXfiiJehtIZu")
      .server("https://parseapi.back4app.com")
      .build()
    );
  }
}

After creating our Application class, we need to define its name on the AndroidManifest.xml file, as follows:

<manifest package="<YOUR_PACKAGE_NAME>"
  ...
  >
  <application
    android:name=".YOUR_ANDROID_APPLICATION"
    ...>
    ...
  </application>

In your application, add the following code into AppDelegate.swift and initialize the Parse SDK with your Parse application ID, client key, and server:

// AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  let parseConfig = ParseClientConfiguration {
      $0.applicationId = "BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f"
      $0.clientKey = "rWFPEbTs7UzkaVsIXnQ4qmmr9oWqwXfiiJehtIZu"
      $0.server = "https://parseapi.back4app.com"
  }
  Parse.initialize(with: parseConfig)
}

In your application, add the following code into AppDelegate.m and initialize the Parse SDK with your Parse application ID, client key, and server:

// AppDelegate.m
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration>  _Nonnull configuration) {
  configuration.applicationId = @"BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f";
  configuration.clientKey = @"rWFPEbTs7UzkaVsIXnQ4qmmr9oWqwXfiiJehtIZu";
  configuration.server = @"https://parseapi.back4app.com";
}]];

After including the Parse-SDK you need to initialize the ParseClient as follows:

using Parse;

ParseClient.Initialize(new ParseClient.Configuration {
    ApplicationId = "BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f",
    WindowsKey = ""
});

You can build the library from Visual Studio 2013+ or Xamarin IDE.

// In Windows:
MSBuild Parse.sln

// In Unix with Xamarin SDK installed:
xbuild Parse.sln

After including the Parse-SDK classes, you need to initialize the ParseClient as follows:

use Parse\ParseClient;

// Initializes with the <APPLICATION_ID>, <REST_KEY>, and <MASTER_KEY>
ParseClient::initialize( "BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f", "swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w", "5AVAtvlGlG5cEeolatkFDhY5p99PzoBUvm7MBLMo" );
ParseClient::setServerURL('https://parseapi.back4app.com', '/');

After installing the Parse SDK, you have to initialize the SDK using your App keys. You can copy them below from the right panel code snippets. At any time you can also find your App keys on your App dashboard under the Security & Keys menu. You don't need to initialize the SDK if you are using cURL, but you must send your app's credentials in the headers of any requests that you'll do.

Application ID

BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

Client key

rWFPEbTs7UzkaVsIXnQ4qmmr9oWqwXfiiJehtIZu

JavaScript key

4wPYRKbpTJeCdmFNaS31AiQZ8344aaYubk6Uo8VW

.NET key

Y1xbq7W0YSJSw1JSOf8hPUgHqXvwgXVEBDck3oaB

REST API key

swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Webhook key

W0683XHye3PU6H4I8mvOL0aMgsyoPrBdnN0rxn4B

File key

8b5c72e4-8894-4dc3-ab9b-d64528420865

Master key

5AVAtvlGlG5cEeolatkFDhY5p99PzoBUvm7MBLMo

Objects API

Example Object:

{
  "objectId": "4BwpMWdCnm",
  "myCustomKey1Name": "myCustomKey1Value",
  "myCustomKey2Name": "myCustomKey2Value",
  "createdAt": "2018-11-06T00:52:01.520Z",
  "updatedAt": "2018-11-06T00:52:04.713Z"
}

The special keys objectId, createdAt and updatedAt are default and always automatically created by the platform.

Performing CRUD (create, read, update and delete) operations through Back4App - Parse Server Hosting - is really simple and can be done using the Objects API. Each object consists of a set of key-value pairs that are transacted through the API as a JSON document. The keys must be alphanumeric strings and the values must be anything that can be JSON-encoded. The objects are organized in classes so you can distinguish different sorts of data.

The data that represents an object is schemaless which means that you don't need to specify ahead of time a new custom class schema. You just need to send the data and Parse will learn from it. But if for any reason you prefer to specify your class schema before sending the data, you can do that using the Create a class button in the Database Browser of your app's Parse Dashboard.

For each new custom class that you create in your app's schema (either through API or just sending the data), a new endpoint is generated at the address below through which you can perform your CRUD operations:

https://parseapi.back4app.com/classes/MyCustomClassName

In addition, a new section in this documentation is automatically generated for each new custom class that you create through which you can learn how to perform the CRUD operations specifically to one class' objects.

Please note that the User class' objects is a special case and has its own API whose documentation you can find here and endpoint is the one that you can find below:

https://parseapi.back4app.com/users

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{"myCustomKey1Name":"myCustomKey1Value","myCustomKey2Name":"myCustomKey2Value"}' \
https://parseapi.back4app.com/classes/MyCustomClassName

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const MyCustomClass = Parse.Object.extend('MyCustomClassName');
const myNewObject = new MyCustomClass();

myNewObject.set('myCustomKey1Name', 'myCustomKey1Value');
myNewObject.set('myCustomKey2Name', 'myCustomKey2Value');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`ParseObject created: ${JSON.stringify(result)}`);
    console.log('ParseObject created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating ParseObject: ${JSON.stringify(error)}`);
    console.error('Error while creating ParseObject: ', error);
  }
);
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.SaveCallback;

public void createObject() {
  String myCustomKey1Value = "foo";
  Integer myCustomKey2Value = 999;

  ParseObject myNewObject = new ParseObject("MyCustomClassName");
  myNewObject.put("myCustomKey1Name", myCustomKey1Value);
  myNewObject.put("myCustomKey2Name", myCustomKey2Value);

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  myNewObject.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"MyCustomClassName")

parseObject["myCustomKey1Name"] = "My custom value"
parseObject["myCustomKey2Name"] = 999

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"MyCustomClassName"];
parseObject[@"myCustomKey1Name"] = @"My custom value";
parseObject[@"myCustomKey2Name"] = @999;

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myCustomClass = new ParseObject("MyCustomClassName");
myCustomClass["myCustomKey1Name"] = "My custom value";
myCustomClass["myCustomKey2Name"] = 999;
await myCustomClass.SaveAsync();
use Parse\ParseException;
use Parse\ParseObject;

$myCustomObject = new ParseObject("MyCustomClassName");

$myCustomObject->set("myCustomKey1Name", "My custom value");
$myCustomObject->set("myCustomKey2Name", 999);

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'MyCustomClassName',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object, you'll need to send a POST request to its class endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/MyCustomClassName/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={\"myCustomKey1Name\":\"myCustomKey1Value\"}" \
https://parseapi.back4app.com/classes/MyCustomClassName

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "myCustomKey1Name": "myCustomKey1Value",
      "myCustomKey2Name": ""
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "myCustomKey1Name": "myCustomKey1Value",
      "myCustomKey2Name": "myCustomKey2Value"
    },
    {
      "objectId": "xKue915KBG",
      "myCustomKey1Name": "myCustomKey1Value",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "myCustomKey2Name": "myCustomKey2Value"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const MyCustomClass = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClass);
query.equalTo("myCustomKey1Name", "myCustomKey1Value");
query.find().then((results) => {
    // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`ParseObjects found: ${JSON.stringify(results)}`);
  console.log('ParseObjects found:', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching ParseObjects: ${JSON.stringify(error)}`);
  console.error('Error while fetching ParseObjects', error);
});

Example Output:

myCustomKey1Value myCustomKey2Value

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClassName");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"MyCustomClassName")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClassName"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string myCustomKey1 = result.Get<string>("myCustomKey1Name");
int myCustomKey2 = result.Get<int>("myCustomKey2Name");

// The same method is applied to the default properties
string objectId = result.ObjectId;
DateTime? updatedAt = result.UpdatedAt;
DateTime? createdAt = result.CreatedAt;
use Parse\ParseException;
use Parse\ParseQuery;

$query = new ParseQuery("MyCustomClassName");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $myCustomKey1Value = $myCustomObject->get("myCustomKey1Name");
  echo $myCustomKey1Value;
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:

curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{"myCustomKeyName":"newValue"}' \
https://parseapi.back4app.com/classes/MyCustomClassName/Ed1nuqPvcm

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{"myCustomKeyName":{"__op":"Delete"}}' \
https://parseapi.back4app.com/classes/MyCustomClassName/

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const MyCustomClass = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClass);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('myCustomKey1Name', 'new value');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated : ${JSON.stringify(response)}`);
    console.log('Updated ', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating : ${JSON.stringify(error)}`);
    console.error('Error while updating ', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'MyCustomClassName', _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const MyCustomClass = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClass);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('myCustomKeyName');

  object.save().then((response) => {
    console.log(response);
  })
}, (error) => {
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'MyCustomClassName', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClassName");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("myCustomKey1Name", "My new value");
        entity.put("myCustomKey2Name", 999);

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"MyCustomClassName")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["myCustomKey1Name"] = "My custom value"
    parseObject["myCustomKey2Name"] = 999

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClassName"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"myCustomKey1Name"] = @"My custom value";
    parseObject[@"myCustomKey2Name"] = @999;
    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject object = await query.GetAsync("<PARSE_OBJECT_ID>");
object["myCustomKey1Name"] = "My new value";
await object.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
// After this, the myCustomKey1Name field will be empty
myObject.Remove("myCustomKey1Name");
await object.SaveAsync();
use Parse\ParseException;
use Parse\ParseQuery;

$query = new ParseQuery("MyCustomClassName");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("myCustomKey1Name", "My new value");
  $myCustomObject->set("myCustomKey2Name", 12345);

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:


curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/MyCustomClassName/Ed1nuqPvcm

Example Response:

{}

Code:

const MyCustomClass = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClass);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted ParseObject: ${JSON.stringify(response)}`);
    console.log('Deleted ParseObject', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting ParseObject: ${JSON.stringify(error)}`);
    console.error('Error while deleting ParseObject', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'MyCustomClassName', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClassName");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("myCustomKey1Name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {

      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClassName"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // After this, the myCustomKey1Name field will be empty
  // [parseObject removeObjectForKey:@"myCustomKey1Name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
use Parse\ParseQuery;
use Parse\ParseException;

$query = new ParseQuery("MyCustomClassName");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the myCustomKey1Name field will be empty
  $myCustomObject->delete("myCustomKey1Name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Understanding Data Types

Parse supports many types of data, from Strings to relations with other Parse Objects, users are able to store their data in our servers with great availability and low latency. Check the list aside with examples of how to define them and use on your application.

Examples:

{
  \"stringExample\": \"A string\",
  \"numberExample\": 1,
  \"booleanExample\": true,
  \"arrayExample\": [ 1, \"a string\" ],
  \"objectExample\": { \"foo\": \"bar\" },
  \"dateExample\": { \"__type\": \"Date\", \"iso\": \"2018-11-06T18:02:52.249Z\" },
  \"fileExample\": { \"__type\": \"File\", \"name\": \"resume.txt\" },
  \"pointerExample\": { \"__type\": \"Pointer\", \"className\": \"<YOUR_CLASS_NAME>\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" },
  \"relationExample\": { \"__type\": \"Relation\", \"className\": \"<YOUR_CLASS_NAME>\" },
  \"geopointExample\": { \"__type\": \"GeoPoint\", \"latitude\": 40.0, \"longitude\": -30.0 },
  \"polygonExample\": {\"__type\":\"Polygon\",\"coordinates\":[[0,0],[0,1],[1,0]]}
}

const stringExample = 'A string';

const numberExample = 1;

const booleanExample = true;

const arrayExample = [1, 'a string'];

const objectExample = { foo: 'bar' };

const dateExample = new Date();

const fileExample = new Parse.File("resume.txt", { base64: btoa("My file content") });

const pointerExample = new Parse.Object("<YOUR_CLASS_NAME>");

const relationExample = new Parse.Object("<YOUR_CLASS_NAME>");

const geopointExample = new Parse.GeoPoint({latitude: 40.0, longitude: -30.0});

const polygonExample = new Parse.Polygon([ [0,0], [0,1], [1,0] ]);

String stringExample = "A string";

int numberExample = 1;

boolean booleanExample = true;

JSONArray arrayExample = new JSONArray();

JSONObject objectExample = new JSONObject();

java.util.Date dateExample = new Date();

ParseFile fileExample = new ParseFile("resume.txt", "My string content".getBytes());

ParseObject pointerExample = new ParseObject("<YOUR_CLASS_NAME>");

ParseRelation relationExample = new ParseObject("<YOUR_CLASS_NAME>");

ParseGeoPoint geopointExample = new ParseGeoPoint(40.0, -30.0);

ParsePolygon polygonExample = new ParsePolygon(Arrays.asList(new ParseGeoPoint(0,0), new ParseGeoPoint(0,1), new ParseGeoPoint(1,0)));

var stringExample = "A string"

var numberExample = 1

var booleanExample = true

var arrayExample = [1, "a string"]

var objectExample = [ "foo": "bar" ]

var dateExample = NSDate()

var fileExample = PFFile(name:"resume.txt", data:"My string content".dataUsingEncoding(NSUTF8StringEncoding))

var pointerExample = PFObject(className:"<YOUR_CLASS_NAME>")

var relationExample = PFObject(className:"<YOUR_CLASS_NAME>")

var geopointExample = PFGeoPoint(latitude:40.0, longitude:-30.0)

var polygonExample = PFPolygon(coordinates: [ [0,0], [0,1], [1,0] ])

NSString stringExample = @"A string";

NSNumber numberExample = @1;

NSNumber booleanExample = @YES;

NSArray arrayExample = @[@1, @"a string"];

NSObject objectExample = @{ @"foo": @"bar" };

NSDate dateExample = [NSDate date];

PFFile fileExample = [PFFile fileWithName:@"resume.txt" data: [@"My string content" dataUsingEncoding:NSUTF8StringEncoding]];

PFObject pointerExample = [PFObject objectWithClassName:@"<YOUR_CLASS_NAME>"];

PFRelation relationExample = [PFObject objectWithClassName:@"<YOUR_CLASS_NAME>"];

PFGeoPoint geopointExample = [PFGeoPoint geoPointWithLatitude:40.0 longitude:-30.0];

PFPolygon polygonExample = [PFPolygon polygonWithCoordinates: @[ @[@0,@0], @[@0,@1], @[@1,@0] ] ];

$stringExample = "A string"

$numberExample = 1

$booleanExample = true

$arrayExample = [1, "a string"]

$objectExample = ["foo" => "bar"]

$dateExample = new DateTime()

$fileExample = ParseFile::createFromData("My resume content", "resume.txt")

$pointerExample = new ParseObject("<YOUR_CLASS_NAME>")

$relationExample = new ParseObject("<YOUR_CLASS_NAME>")

$geopointExample = new ParseGeoPoint(40.0, -30.0)

$polygonExample = new ParsePolygon([ new ParseGeoPoint(0, 0), new ParseGeoPoint(0, 1), new ParseGeoPoint(1, 0) ])

string stringExample = "A string";

int numberExample = 1;

bool booleanExample = true;

IList arrayExample = new List<object>{1, "a string"};

IDictionary objectExample = new Dictionary<string, object> { { "number", number }, { "string", str } };

DateTime dateExample = DateTime.Now;

ParseFile fileExample =  new ParseFile("resume.txt", System.Text.Encoding.UTF8.GetBytes("My string content"));;

ParseObject pointerExample = new ParseObject("<YOUR_CLASS_NAME>");

ParseRelation relationExample = new ParseObject("<YOUR_CLASS_NAME>");

ParseGeoPoint geopointExample = new ParseGeoPoint(40.0, -30.0);

//  polygonExample = <NOT_AVAILABLE>;

Pins Class

Example JSON:

{
  "pin": "A string"
}

Pins is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Pins

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
pin String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"pin\":\"A string\" }" \
https://parseapi.back4app.com/classes/Pins

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Pins = Parse.Object.extend('Pins');
const myNewObject = new Pins();

myNewObject.set('pin', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Pins created: ${JSON.stringify(result)}`);
    console.log('Pins created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Pins: ${JSON.stringify(error)}`);
    console.error('Error while creating Pins: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Pins");

  entity.put("pin", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Pins")

parseObject["pin"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Pins"];

parseObject[@"pin"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Pins");
myObject["pin"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Pins");

$myCustomObject->set("pin", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Pins',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Pins class, you'll need to send a POST request to the Pins class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pins

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Pins/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"pin\":\"A string\" }" \
https://parseapi.back4app.com/classes/Pins

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "pin": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "pin": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "pin": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Pins = Parse.Object.extend('Pins');
const query = new Parse.Query(Pins);
query.equalTo("pin", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Pins found: ${JSON.stringify(results)}`);
  console.log('Pins found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Pins: ${JSON.stringify(error)}`);
  console.error('Error while fetching Pins', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Pins");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Pins")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Pins"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Pins");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string pin = result.Get<string>("pin");
$query = new ParseQuery("Pins");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $pin = $myCustomObject->get("pin");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pins

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"pin\": \"A string\" }" \
https://parseapi.back4app.com/classes/Pins/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "pin": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Pins

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Pins = Parse.Object.extend('Pins');
const query = new Parse.Query(Pins);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('pin', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Pins: ${JSON.stringify(response)}`);
    console.log('Updated Pins', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Pins: ${JSON.stringify(error)}`);
    console.error('Error while updating Pins', error);
  });
});

Example Output:

ParseObjectSubclass { className: Pins, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Pins = Parse.Object.extend('Pins');
const query = new Parse.Query(Pins);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Pins: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Pins: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Pins', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Pins");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("pin", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Pins")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["pin"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Pins"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"pin"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Pins");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["pin"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("pin");
await myObject.SaveAsync();
$query = new ParseQuery("Pins");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("pin", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pins/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Pins/<OBJECT_ID>

Example Response:

{}

Code:

const Pins = Parse.Object.extend('Pins');
const query = new Parse.Query(Pins);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Pins: ${JSON.stringify(response)}`);
    console.log('Deleted Pins', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Pins: ${JSON.stringify(error)}`);
    console.error('Error while deleting Pins', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Pins', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Pins");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("pin");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Pins")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("pin")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Pins"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"pin"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Pins");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Pins");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("pin");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pins/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

MyCustomClassName Class

Example JSON:

{
  "myCustomKey1Name": "A string",
  "myCustomKey2Name": "A string",
  "temperature": 1,
  "humidity": 1
}

MyCustomClassName is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/MyCustomClassName

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
myCustomKey1Name String "A string"
myCustomKey2Name String "A string"
temperature Number 1
humidity Number 1

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\",\"temperature\":1,\"humidity\":1 }" \
https://parseapi.back4app.com/classes/MyCustomClassName

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const MyCustomClassName = Parse.Object.extend('MyCustomClassName');
const myNewObject = new MyCustomClassName();

myNewObject.set('myCustomKey1Name', 'A string');
myNewObject.set('myCustomKey2Name', 'A string');
myNewObject.set('temperature', 1);
myNewObject.set('humidity', 1);

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`MyCustomClassName created: ${JSON.stringify(result)}`);
    console.log('MyCustomClassName created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating MyCustomClassName: ${JSON.stringify(error)}`);
    console.error('Error while creating MyCustomClassName: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("MyCustomClassName");

  entity.put("myCustomKey1Name", "A string");
  entity.put("myCustomKey2Name", "A string");
  entity.put("temperature", 1);
  entity.put("humidity", 1);

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"MyCustomClassName")

parseObject["myCustomKey1Name"] = "A string"
parseObject["myCustomKey2Name"] = "A string"
parseObject["temperature"] = 1
parseObject["humidity"] = 1

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"MyCustomClassName"];

parseObject[@"myCustomKey1Name"] = @"A string";
parseObject[@"myCustomKey2Name"] = @"A string";
parseObject[@"temperature"] = @1;
parseObject[@"humidity"] = @1;

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("MyCustomClassName");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
myObject["temperature"] = 1;
myObject["humidity"] = 1;
await myObject.SaveAsync();
$myCustomObject = new ParseObject("MyCustomClassName");

$myCustomObject->set("myCustomKey1Name", "A string");
$myCustomObject->set("myCustomKey2Name", "A string");
$myCustomObject->set("temperature", 1);
$myCustomObject->set("humidity", 1);

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'MyCustomClassName',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the MyCustomClassName class, you'll need to send a POST request to the MyCustomClassName class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/MyCustomClassName/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\",\"temperature\":1,\"humidity\":1 }" \
https://parseapi.back4app.com/classes/MyCustomClassName

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\","temperature": 1,"humidity": 1
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\","temperature": 1,"humidity": 1
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\","temperature": 1,"humidity": 1
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const MyCustomClassName = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClassName);
query.equalTo("myCustomKey1Name", 'A string');
query.equalTo("myCustomKey2Name", 'A string');
query.equalTo("temperature", 1);
query.equalTo("humidity", 1);
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`MyCustomClassName found: ${JSON.stringify(results)}`);
  console.log('MyCustomClassName found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching MyCustomClassName: ${JSON.stringify(error)}`);
  console.error('Error while fetching MyCustomClassName', error);
});

Example Output:

'A string' 'A string' 1 1 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClassName");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"MyCustomClassName")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClassName"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string myCustomKey1Name = result.Get<string>("myCustomKey1Name");
string myCustomKey2Name = result.Get<string>("myCustomKey2Name");
int temperature = result.Get<int>("temperature");
int humidity = result.Get<int>("humidity");
$query = new ParseQuery("MyCustomClassName");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $myCustomKey1Name = $myCustomObject->get("myCustomKey1Name");
  $myCustomKey2Name = $myCustomObject->get("myCustomKey2Name");
  $temperature = $myCustomObject->get("temperature");
  $humidity = $myCustomObject->get("humidity");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\": \"A string\",\"myCustomKey2Name\": \"A string\",\"temperature\": 1,\"humidity\": 1 }" \
https://parseapi.back4app.com/classes/MyCustomClassName/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "myCustomKey1Name": {"__op":"Delete"},"myCustomKey2Name": {"__op":"Delete"},"temperature": {"__op":"Delete"},"humidity": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/MyCustomClassName

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const MyCustomClassName = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClassName);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('myCustomKey1Name', 'A string');
  object.set('myCustomKey2Name', 'A string');
  object.set('temperature', 1);
  object.set('humidity', 1);
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated MyCustomClassName: ${JSON.stringify(response)}`);
    console.log('Updated MyCustomClassName', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating MyCustomClassName: ${JSON.stringify(error)}`);
    console.error('Error while updating MyCustomClassName', error);
  });
});

Example Output:

ParseObjectSubclass { className: MyCustomClassName, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const MyCustomClassName = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClassName);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated MyCustomClassName: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating MyCustomClassName: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'MyCustomClassName', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClassName");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("myCustomKey1Name", "A string");
        entity.put("myCustomKey2Name", "A string");
        entity.put("temperature", 1);
        entity.put("humidity", 1);

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"MyCustomClassName")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["myCustomKey1Name"] = "A string"
    parseObject["myCustomKey2Name"] = "A string"
    parseObject["temperature"] = 1
    parseObject["humidity"] = 1

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClassName"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"myCustomKey1Name"] = @"A string";
    parseObject[@"myCustomKey2Name"] = @"A string";
    parseObject[@"temperature"] = @1;
    parseObject[@"humidity"] = @1;

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
myObject["temperature"] = 1;
myObject["humidity"] = 1;
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("myCustomKey1Name");
myObject.Remove("myCustomKey2Name");
myObject.Remove("temperature");
myObject.Remove("humidity");
await myObject.SaveAsync();
$query = new ParseQuery("MyCustomClassName");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("myCustomKey1Name", "A string");
  $myCustomObject->set("myCustomKey2Name", "A string");
  $myCustomObject->set("temperature", 1);
  $myCustomObject->set("humidity", 1);

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/MyCustomClassName/<OBJECT_ID>

Example Response:

{}

Code:

const MyCustomClassName = Parse.Object.extend('MyCustomClassName');
const query = new Parse.Query(MyCustomClassName);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted MyCustomClassName: ${JSON.stringify(response)}`);
    console.log('Deleted MyCustomClassName', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting MyCustomClassName: ${JSON.stringify(error)}`);
    console.error('Error while deleting MyCustomClassName', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'MyCustomClassName', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClassName");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("myCustomKey1Name");
          entity.remove("myCustomKey2Name");
          entity.remove("temperature");
          entity.remove("humidity");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"MyCustomClassName")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("myCustomKey1Name")
      parseObject.removeObjectForKey("myCustomKey2Name")
      parseObject.removeObjectForKey("temperature")
      parseObject.removeObjectForKey("humidity")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClassName"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"myCustomKey1Name"];
  // [parseObject removeObjectForKey:@"myCustomKey2Name"];
  // [parseObject removeObjectForKey:@"temperature"];
  // [parseObject removeObjectForKey:@"humidity"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("MyCustomClassName");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("myCustomKey1Name");
  $myCustomObject->delete("myCustomKey2Name");
  $myCustomObject->delete("temperature");
  $myCustomObject->delete("humidity");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyCustomClassName/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Pet Class

Example JSON:

{
  "name": "A string",
  "agePet": 1
}

Pet is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Pet

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
name String "A string"
agePet Number 1

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\":\"A string\",\"agePet\":1 }" \
https://parseapi.back4app.com/classes/Pet

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Pet = Parse.Object.extend('Pet');
const myNewObject = new Pet();

myNewObject.set('name', 'A string');
myNewObject.set('agePet', 1);

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Pet created: ${JSON.stringify(result)}`);
    console.log('Pet created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Pet: ${JSON.stringify(error)}`);
    console.error('Error while creating Pet: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Pet");

  entity.put("name", "A string");
  entity.put("agePet", 1);

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Pet")

parseObject["name"] = "A string"
parseObject["agePet"] = 1

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Pet"];

parseObject[@"name"] = @"A string";
parseObject[@"agePet"] = @1;

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Pet");
myObject["name"] = "A string";
myObject["agePet"] = 1;
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Pet");

$myCustomObject->set("name", "A string");
$myCustomObject->set("agePet", 1);

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Pet',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Pet class, you'll need to send a POST request to the Pet class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pet

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Pet/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"name\":\"A string\",\"agePet\":1 }" \
https://parseapi.back4app.com/classes/Pet

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "name": \"A string\","agePet": 1
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "name": \"A string\","agePet": 1
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "name": \"A string\","agePet": 1
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Pet = Parse.Object.extend('Pet');
const query = new Parse.Query(Pet);
query.equalTo("name", 'A string');
query.equalTo("agePet", 1);
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Pet found: ${JSON.stringify(results)}`);
  console.log('Pet found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Pet: ${JSON.stringify(error)}`);
  console.error('Error while fetching Pet', error);
});

Example Output:

'A string' 1 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Pet");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Pet")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Pet"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Pet");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string name = result.Get<string>("name");
int agePet = result.Get<int>("agePet");
$query = new ParseQuery("Pet");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $name = $myCustomObject->get("name");
  $agePet = $myCustomObject->get("agePet");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pet

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\": \"A string\",\"agePet\": 1 }" \
https://parseapi.back4app.com/classes/Pet/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "name": {"__op":"Delete"},"agePet": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Pet

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Pet = Parse.Object.extend('Pet');
const query = new Parse.Query(Pet);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('name', 'A string');
  object.set('agePet', 1);
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Pet: ${JSON.stringify(response)}`);
    console.log('Updated Pet', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Pet: ${JSON.stringify(error)}`);
    console.error('Error while updating Pet', error);
  });
});

Example Output:

ParseObjectSubclass { className: Pet, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Pet = Parse.Object.extend('Pet');
const query = new Parse.Query(Pet);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Pet: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Pet: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Pet', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Pet");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("name", "A string");
        entity.put("agePet", 1);

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Pet")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["name"] = "A string"
    parseObject["agePet"] = 1

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Pet"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"name"] = @"A string";
    parseObject[@"agePet"] = @1;

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Pet");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["name"] = "A string";
myObject["agePet"] = 1;
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("name");
myObject.Remove("agePet");
await myObject.SaveAsync();
$query = new ParseQuery("Pet");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("name", "A string");
  $myCustomObject->set("agePet", 1);

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pet/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Pet/<OBJECT_ID>

Example Response:

{}

Code:

const Pet = Parse.Object.extend('Pet');
const query = new Parse.Query(Pet);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Pet: ${JSON.stringify(response)}`);
    console.log('Deleted Pet', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Pet: ${JSON.stringify(error)}`);
    console.error('Error while deleting Pet', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Pet', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Pet");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("name");
          entity.remove("agePet");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Pet")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("name")
      parseObject.removeObjectForKey("agePet")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Pet"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"name"];
  // [parseObject removeObjectForKey:@"agePet"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Pet");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Pet");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("name");
  $myCustomObject->delete("agePet");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Pet/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

B4aVehicle Class

Example JSON:

{
  "myCustomKey1Name": "A string",
  "myCustomKey2Name": "A string",
  "price": "A string",
  "name": "A string",
  "color": "A string"
}

B4aVehicle is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/B4aVehicle

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
myCustomKey1Name String "A string"
myCustomKey2Name String "A string"
price String "A string"
name String "A string"
color String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\",\"price\":\"A string\",\"name\":\"A string\",\"color\":\"A string\" }" \
https://parseapi.back4app.com/classes/B4aVehicle

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const B4aVehicle = Parse.Object.extend('B4aVehicle');
const myNewObject = new B4aVehicle();

myNewObject.set('myCustomKey1Name', 'A string');
myNewObject.set('myCustomKey2Name', 'A string');
myNewObject.set('price', 'A string');
myNewObject.set('name', 'A string');
myNewObject.set('color', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`B4aVehicle created: ${JSON.stringify(result)}`);
    console.log('B4aVehicle created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating B4aVehicle: ${JSON.stringify(error)}`);
    console.error('Error while creating B4aVehicle: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("B4aVehicle");

  entity.put("myCustomKey1Name", "A string");
  entity.put("myCustomKey2Name", "A string");
  entity.put("price", "A string");
  entity.put("name", "A string");
  entity.put("color", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"B4aVehicle")

parseObject["myCustomKey1Name"] = "A string"
parseObject["myCustomKey2Name"] = "A string"
parseObject["price"] = "A string"
parseObject["name"] = "A string"
parseObject["color"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"B4aVehicle"];

parseObject[@"myCustomKey1Name"] = @"A string";
parseObject[@"myCustomKey2Name"] = @"A string";
parseObject[@"price"] = @"A string";
parseObject[@"name"] = @"A string";
parseObject[@"color"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("B4aVehicle");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
myObject["price"] = "A string";
myObject["name"] = "A string";
myObject["color"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("B4aVehicle");

$myCustomObject->set("myCustomKey1Name", "A string");
$myCustomObject->set("myCustomKey2Name", "A string");
$myCustomObject->set("price", "A string");
$myCustomObject->set("name", "A string");
$myCustomObject->set("color", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'B4aVehicle',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the B4aVehicle class, you'll need to send a POST request to the B4aVehicle class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/B4aVehicle

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/B4aVehicle/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\",\"price\":\"A string\",\"name\":\"A string\",\"color\":\"A string\" }" \
https://parseapi.back4app.com/classes/B4aVehicle

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\","price": \"A string\","name": \"A string\","color": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\","price": \"A string\","name": \"A string\","color": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\","price": \"A string\","name": \"A string\","color": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const B4aVehicle = Parse.Object.extend('B4aVehicle');
const query = new Parse.Query(B4aVehicle);
query.equalTo("myCustomKey1Name", 'A string');
query.equalTo("myCustomKey2Name", 'A string');
query.equalTo("price", 'A string');
query.equalTo("name", 'A string');
query.equalTo("color", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`B4aVehicle found: ${JSON.stringify(results)}`);
  console.log('B4aVehicle found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching B4aVehicle: ${JSON.stringify(error)}`);
  console.error('Error while fetching B4aVehicle', error);
});

Example Output:

'A string' 'A string' 'A string' 'A string' 'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("B4aVehicle");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"B4aVehicle")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"B4aVehicle"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("B4aVehicle");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string myCustomKey1Name = result.Get<string>("myCustomKey1Name");
string myCustomKey2Name = result.Get<string>("myCustomKey2Name");
string price = result.Get<string>("price");
string name = result.Get<string>("name");
string color = result.Get<string>("color");
$query = new ParseQuery("B4aVehicle");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $myCustomKey1Name = $myCustomObject->get("myCustomKey1Name");
  $myCustomKey2Name = $myCustomObject->get("myCustomKey2Name");
  $price = $myCustomObject->get("price");
  $name = $myCustomObject->get("name");
  $color = $myCustomObject->get("color");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/B4aVehicle

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\": \"A string\",\"myCustomKey2Name\": \"A string\",\"price\": \"A string\",\"name\": \"A string\",\"color\": \"A string\" }" \
https://parseapi.back4app.com/classes/B4aVehicle/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "myCustomKey1Name": {"__op":"Delete"},"myCustomKey2Name": {"__op":"Delete"},"price": {"__op":"Delete"},"name": {"__op":"Delete"},"color": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/B4aVehicle

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const B4aVehicle = Parse.Object.extend('B4aVehicle');
const query = new Parse.Query(B4aVehicle);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('myCustomKey1Name', 'A string');
  object.set('myCustomKey2Name', 'A string');
  object.set('price', 'A string');
  object.set('name', 'A string');
  object.set('color', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated B4aVehicle: ${JSON.stringify(response)}`);
    console.log('Updated B4aVehicle', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating B4aVehicle: ${JSON.stringify(error)}`);
    console.error('Error while updating B4aVehicle', error);
  });
});

Example Output:

ParseObjectSubclass { className: B4aVehicle, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const B4aVehicle = Parse.Object.extend('B4aVehicle');
const query = new Parse.Query(B4aVehicle);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated B4aVehicle: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating B4aVehicle: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'B4aVehicle', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("B4aVehicle");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("myCustomKey1Name", "A string");
        entity.put("myCustomKey2Name", "A string");
        entity.put("price", "A string");
        entity.put("name", "A string");
        entity.put("color", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"B4aVehicle")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["myCustomKey1Name"] = "A string"
    parseObject["myCustomKey2Name"] = "A string"
    parseObject["price"] = "A string"
    parseObject["name"] = "A string"
    parseObject["color"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"B4aVehicle"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"myCustomKey1Name"] = @"A string";
    parseObject[@"myCustomKey2Name"] = @"A string";
    parseObject[@"price"] = @"A string";
    parseObject[@"name"] = @"A string";
    parseObject[@"color"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("B4aVehicle");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
myObject["price"] = "A string";
myObject["name"] = "A string";
myObject["color"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("myCustomKey1Name");
myObject.Remove("myCustomKey2Name");
myObject.Remove("price");
myObject.Remove("name");
myObject.Remove("color");
await myObject.SaveAsync();
$query = new ParseQuery("B4aVehicle");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("myCustomKey1Name", "A string");
  $myCustomObject->set("myCustomKey2Name", "A string");
  $myCustomObject->set("price", "A string");
  $myCustomObject->set("name", "A string");
  $myCustomObject->set("color", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/B4aVehicle/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/B4aVehicle/<OBJECT_ID>

Example Response:

{}

Code:

const B4aVehicle = Parse.Object.extend('B4aVehicle');
const query = new Parse.Query(B4aVehicle);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted B4aVehicle: ${JSON.stringify(response)}`);
    console.log('Deleted B4aVehicle', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting B4aVehicle: ${JSON.stringify(error)}`);
    console.error('Error while deleting B4aVehicle', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'B4aVehicle', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("B4aVehicle");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("myCustomKey1Name");
          entity.remove("myCustomKey2Name");
          entity.remove("price");
          entity.remove("name");
          entity.remove("color");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"B4aVehicle")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("myCustomKey1Name")
      parseObject.removeObjectForKey("myCustomKey2Name")
      parseObject.removeObjectForKey("price")
      parseObject.removeObjectForKey("name")
      parseObject.removeObjectForKey("color")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"B4aVehicle"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"myCustomKey1Name"];
  // [parseObject removeObjectForKey:@"myCustomKey2Name"];
  // [parseObject removeObjectForKey:@"price"];
  // [parseObject removeObjectForKey:@"name"];
  // [parseObject removeObjectForKey:@"color"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("B4aVehicle");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("B4aVehicle");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("myCustomKey1Name");
  $myCustomObject->delete("myCustomKey2Name");
  $myCustomObject->delete("price");
  $myCustomObject->delete("name");
  $myCustomObject->delete("color");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/B4aVehicle/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

tour Class

Example JSON:

{
  "name": "A string"
}

tour is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/tour

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/tour

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const tour = Parse.Object.extend('tour');
const myNewObject = new tour();

myNewObject.set('name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`tour created: ${JSON.stringify(result)}`);
    console.log('tour created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating tour: ${JSON.stringify(error)}`);
    console.error('Error while creating tour: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("tour");

  entity.put("name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"tour")

parseObject["name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"tour"];

parseObject[@"name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("tour");
myObject["name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("tour");

$myCustomObject->set("name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'tour',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the tour class, you'll need to send a POST request to the tour class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tour

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/tour/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/tour

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const tour = Parse.Object.extend('tour');
const query = new Parse.Query(tour);
query.equalTo("name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`tour found: ${JSON.stringify(results)}`);
  console.log('tour found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching tour: ${JSON.stringify(error)}`);
  console.error('Error while fetching tour', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("tour");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"tour")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"tour"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("tour");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string name = result.Get<string>("name");
$query = new ParseQuery("tour");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $name = $myCustomObject->get("name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tour

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\": \"A string\" }" \
https://parseapi.back4app.com/classes/tour/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/tour

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const tour = Parse.Object.extend('tour');
const query = new Parse.Query(tour);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated tour: ${JSON.stringify(response)}`);
    console.log('Updated tour', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating tour: ${JSON.stringify(error)}`);
    console.error('Error while updating tour', error);
  });
});

Example Output:

ParseObjectSubclass { className: tour, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const tour = Parse.Object.extend('tour');
const query = new Parse.Query(tour);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated tour: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating tour: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'tour', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("tour");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"tour")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"tour"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("tour");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("name");
await myObject.SaveAsync();
$query = new ParseQuery("tour");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tour/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/tour/<OBJECT_ID>

Example Response:

{}

Code:

const tour = Parse.Object.extend('tour');
const query = new Parse.Query(tour);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted tour: ${JSON.stringify(response)}`);
    console.log('Deleted tour', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting tour: ${JSON.stringify(error)}`);
    console.error('Error while deleting tour', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'tour', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("tour");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"tour")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"tour"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("tour");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("tour");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tour/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

tourf Class

Example JSON:

{
  "name": "A string"
}

tourf is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/tourf

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/tourf

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const tourf = Parse.Object.extend('tourf');
const myNewObject = new tourf();

myNewObject.set('name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`tourf created: ${JSON.stringify(result)}`);
    console.log('tourf created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating tourf: ${JSON.stringify(error)}`);
    console.error('Error while creating tourf: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("tourf");

  entity.put("name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"tourf")

parseObject["name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"tourf"];

parseObject[@"name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("tourf");
myObject["name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("tourf");

$myCustomObject->set("name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'tourf',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the tourf class, you'll need to send a POST request to the tourf class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tourf

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/tourf/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/tourf

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const tourf = Parse.Object.extend('tourf');
const query = new Parse.Query(tourf);
query.equalTo("name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`tourf found: ${JSON.stringify(results)}`);
  console.log('tourf found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching tourf: ${JSON.stringify(error)}`);
  console.error('Error while fetching tourf', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("tourf");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"tourf")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"tourf"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("tourf");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string name = result.Get<string>("name");
$query = new ParseQuery("tourf");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $name = $myCustomObject->get("name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tourf

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\": \"A string\" }" \
https://parseapi.back4app.com/classes/tourf/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/tourf

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const tourf = Parse.Object.extend('tourf');
const query = new Parse.Query(tourf);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated tourf: ${JSON.stringify(response)}`);
    console.log('Updated tourf', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating tourf: ${JSON.stringify(error)}`);
    console.error('Error while updating tourf', error);
  });
});

Example Output:

ParseObjectSubclass { className: tourf, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const tourf = Parse.Object.extend('tourf');
const query = new Parse.Query(tourf);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated tourf: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating tourf: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'tourf', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("tourf");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"tourf")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"tourf"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("tourf");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("name");
await myObject.SaveAsync();
$query = new ParseQuery("tourf");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tourf/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/tourf/<OBJECT_ID>

Example Response:

{}

Code:

const tourf = Parse.Object.extend('tourf');
const query = new Parse.Query(tourf);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted tourf: ${JSON.stringify(response)}`);
    console.log('Deleted tourf', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting tourf: ${JSON.stringify(error)}`);
    console.error('Error while deleting tourf', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'tourf', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("tourf");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"tourf")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"tourf"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("tourf");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("tourf");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/tourf/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Agent Class

Example JSON:

{
  "HealthLost": 1
}

Agent is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Agent

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
HealthLost Number 1

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"HealthLost\":1 }" \
https://parseapi.back4app.com/classes/Agent

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Agent = Parse.Object.extend('Agent');
const myNewObject = new Agent();

myNewObject.set('HealthLost', 1);

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Agent created: ${JSON.stringify(result)}`);
    console.log('Agent created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Agent: ${JSON.stringify(error)}`);
    console.error('Error while creating Agent: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Agent");

  entity.put("HealthLost", 1);

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Agent")

parseObject["HealthLost"] = 1

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Agent"];

parseObject[@"HealthLost"] = @1;

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Agent");
myObject["HealthLost"] = 1;
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Agent");

$myCustomObject->set("HealthLost", 1);

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Agent',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Agent class, you'll need to send a POST request to the Agent class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Agent

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Agent/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"HealthLost\":1 }" \
https://parseapi.back4app.com/classes/Agent

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "HealthLost": 1
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "HealthLost": 1
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "HealthLost": 1
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Agent = Parse.Object.extend('Agent');
const query = new Parse.Query(Agent);
query.equalTo("HealthLost", 1);
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Agent found: ${JSON.stringify(results)}`);
  console.log('Agent found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Agent: ${JSON.stringify(error)}`);
  console.error('Error while fetching Agent', error);
});

Example Output:

1 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Agent");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Agent")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Agent"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Agent");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
int HealthLost = result.Get<int>("HealthLost");
$query = new ParseQuery("Agent");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $HealthLost = $myCustomObject->get("HealthLost");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Agent

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"HealthLost\": 1 }" \
https://parseapi.back4app.com/classes/Agent/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "HealthLost": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Agent

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Agent = Parse.Object.extend('Agent');
const query = new Parse.Query(Agent);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('HealthLost', 1);
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Agent: ${JSON.stringify(response)}`);
    console.log('Updated Agent', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Agent: ${JSON.stringify(error)}`);
    console.error('Error while updating Agent', error);
  });
});

Example Output:

ParseObjectSubclass { className: Agent, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Agent = Parse.Object.extend('Agent');
const query = new Parse.Query(Agent);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Agent: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Agent: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Agent', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Agent");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("HealthLost", 1);

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Agent")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["HealthLost"] = 1

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Agent"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"HealthLost"] = @1;

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Agent");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["HealthLost"] = 1;
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("HealthLost");
await myObject.SaveAsync();
$query = new ParseQuery("Agent");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("HealthLost", 1);

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Agent/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Agent/<OBJECT_ID>

Example Response:

{}

Code:

const Agent = Parse.Object.extend('Agent');
const query = new Parse.Query(Agent);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Agent: ${JSON.stringify(response)}`);
    console.log('Deleted Agent', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Agent: ${JSON.stringify(error)}`);
    console.error('Error while deleting Agent', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Agent', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Agent");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("HealthLost");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Agent")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("HealthLost")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Agent"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"HealthLost"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Agent");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Agent");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("HealthLost");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Agent/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Omar Class

Example JSON:

{
  "username": "A string"
}

Omar is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Omar

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
username String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"username\":\"A string\" }" \
https://parseapi.back4app.com/classes/Omar

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Omar = Parse.Object.extend('Omar');
const myNewObject = new Omar();

myNewObject.set('username', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Omar created: ${JSON.stringify(result)}`);
    console.log('Omar created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Omar: ${JSON.stringify(error)}`);
    console.error('Error while creating Omar: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Omar");

  entity.put("username", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Omar")

parseObject["username"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Omar"];

parseObject[@"username"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Omar");
myObject["username"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Omar");

$myCustomObject->set("username", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Omar',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Omar class, you'll need to send a POST request to the Omar class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Omar

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Omar/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"username\":\"A string\" }" \
https://parseapi.back4app.com/classes/Omar

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "username": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "username": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "username": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Omar = Parse.Object.extend('Omar');
const query = new Parse.Query(Omar);
query.equalTo("username", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Omar found: ${JSON.stringify(results)}`);
  console.log('Omar found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Omar: ${JSON.stringify(error)}`);
  console.error('Error while fetching Omar', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Omar");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Omar")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Omar"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Omar");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string username = result.Get<string>("username");
$query = new ParseQuery("Omar");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $username = $myCustomObject->get("username");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Omar

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"username\": \"A string\" }" \
https://parseapi.back4app.com/classes/Omar/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "username": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Omar

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Omar = Parse.Object.extend('Omar');
const query = new Parse.Query(Omar);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('username', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Omar: ${JSON.stringify(response)}`);
    console.log('Updated Omar', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Omar: ${JSON.stringify(error)}`);
    console.error('Error while updating Omar', error);
  });
});

Example Output:

ParseObjectSubclass { className: Omar, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Omar = Parse.Object.extend('Omar');
const query = new Parse.Query(Omar);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Omar: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Omar: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Omar', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Omar");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("username", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Omar")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["username"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Omar"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"username"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Omar");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["username"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("username");
await myObject.SaveAsync();
$query = new ParseQuery("Omar");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("username", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Omar/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Omar/<OBJECT_ID>

Example Response:

{}

Code:

const Omar = Parse.Object.extend('Omar');
const query = new Parse.Query(Omar);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Omar: ${JSON.stringify(response)}`);
    console.log('Deleted Omar', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Omar: ${JSON.stringify(error)}`);
    console.error('Error while deleting Omar', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Omar', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Omar");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("username");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Omar")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("username")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Omar"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"username"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Omar");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Omar");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("username");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Omar/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

MyFirstClass Class

Example JSON:

{
  "name": "A string"
}

MyFirstClass is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/MyFirstClass

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/MyFirstClass

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const MyFirstClass = Parse.Object.extend('MyFirstClass');
const myNewObject = new MyFirstClass();

myNewObject.set('name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`MyFirstClass created: ${JSON.stringify(result)}`);
    console.log('MyFirstClass created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating MyFirstClass: ${JSON.stringify(error)}`);
    console.error('Error while creating MyFirstClass: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("MyFirstClass");

  entity.put("name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"MyFirstClass")

parseObject["name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"MyFirstClass"];

parseObject[@"name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("MyFirstClass");
myObject["name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("MyFirstClass");

$myCustomObject->set("name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'MyFirstClass',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the MyFirstClass class, you'll need to send a POST request to the MyFirstClass class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyFirstClass

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/MyFirstClass/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/MyFirstClass

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const MyFirstClass = Parse.Object.extend('MyFirstClass');
const query = new Parse.Query(MyFirstClass);
query.equalTo("name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`MyFirstClass found: ${JSON.stringify(results)}`);
  console.log('MyFirstClass found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching MyFirstClass: ${JSON.stringify(error)}`);
  console.error('Error while fetching MyFirstClass', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyFirstClass");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"MyFirstClass")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyFirstClass"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyFirstClass");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string name = result.Get<string>("name");
$query = new ParseQuery("MyFirstClass");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $name = $myCustomObject->get("name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyFirstClass

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\": \"A string\" }" \
https://parseapi.back4app.com/classes/MyFirstClass/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/MyFirstClass

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const MyFirstClass = Parse.Object.extend('MyFirstClass');
const query = new Parse.Query(MyFirstClass);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated MyFirstClass: ${JSON.stringify(response)}`);
    console.log('Updated MyFirstClass', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating MyFirstClass: ${JSON.stringify(error)}`);
    console.error('Error while updating MyFirstClass', error);
  });
});

Example Output:

ParseObjectSubclass { className: MyFirstClass, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const MyFirstClass = Parse.Object.extend('MyFirstClass');
const query = new Parse.Query(MyFirstClass);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated MyFirstClass: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating MyFirstClass: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'MyFirstClass', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyFirstClass");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"MyFirstClass")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyFirstClass"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyFirstClass");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("name");
await myObject.SaveAsync();
$query = new ParseQuery("MyFirstClass");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyFirstClass/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/MyFirstClass/<OBJECT_ID>

Example Response:

{}

Code:

const MyFirstClass = Parse.Object.extend('MyFirstClass');
const query = new Parse.Query(MyFirstClass);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted MyFirstClass: ${JSON.stringify(response)}`);
    console.log('Deleted MyFirstClass', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting MyFirstClass: ${JSON.stringify(error)}`);
    console.error('Error while deleting MyFirstClass', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'MyFirstClass', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyFirstClass");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"MyFirstClass")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"MyFirstClass"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("MyFirstClass");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("MyFirstClass");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/MyFirstClass/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Category Class

Example JSON:

{
  "CategoryName": "A string"
}

Category is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Category

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
CategoryName String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"CategoryName\":\"A string\" }" \
https://parseapi.back4app.com/classes/Category

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Category = Parse.Object.extend('Category');
const myNewObject = new Category();

myNewObject.set('CategoryName', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Category created: ${JSON.stringify(result)}`);
    console.log('Category created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Category: ${JSON.stringify(error)}`);
    console.error('Error while creating Category: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Category");

  entity.put("CategoryName", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Category")

parseObject["CategoryName"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Category"];

parseObject[@"CategoryName"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Category");
myObject["CategoryName"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Category");

$myCustomObject->set("CategoryName", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Category',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Category class, you'll need to send a POST request to the Category class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Category

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Category/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"CategoryName\":\"A string\" }" \
https://parseapi.back4app.com/classes/Category

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "CategoryName": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "CategoryName": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "CategoryName": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Category = Parse.Object.extend('Category');
const query = new Parse.Query(Category);
query.equalTo("CategoryName", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Category found: ${JSON.stringify(results)}`);
  console.log('Category found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Category: ${JSON.stringify(error)}`);
  console.error('Error while fetching Category', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Category");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Category")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Category"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Category");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string CategoryName = result.Get<string>("CategoryName");
$query = new ParseQuery("Category");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $CategoryName = $myCustomObject->get("CategoryName");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Category

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"CategoryName\": \"A string\" }" \
https://parseapi.back4app.com/classes/Category/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "CategoryName": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Category

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Category = Parse.Object.extend('Category');
const query = new Parse.Query(Category);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('CategoryName', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Category: ${JSON.stringify(response)}`);
    console.log('Updated Category', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Category: ${JSON.stringify(error)}`);
    console.error('Error while updating Category', error);
  });
});

Example Output:

ParseObjectSubclass { className: Category, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Category = Parse.Object.extend('Category');
const query = new Parse.Query(Category);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Category: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Category: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Category', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Category");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("CategoryName", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Category")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["CategoryName"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Category"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"CategoryName"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Category");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["CategoryName"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("CategoryName");
await myObject.SaveAsync();
$query = new ParseQuery("Category");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("CategoryName", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Category/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Category/<OBJECT_ID>

Example Response:

{}

Code:

const Category = Parse.Object.extend('Category');
const query = new Parse.Query(Category);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Category: ${JSON.stringify(response)}`);
    console.log('Deleted Category', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Category: ${JSON.stringify(error)}`);
    console.error('Error while deleting Category', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Category', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Category");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("CategoryName");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Category")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("CategoryName")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Category"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"CategoryName"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Category");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Category");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("CategoryName");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Category/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Post Class

Example JSON:

{
  "content": "A string",
  "tags": [1, "a string"],
  "body": "A string",
  "numComments": 1
}

Post is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Post

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
content String "A string"
tags Array [1, "a string"]
body String "A string"
numComments Number 1

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"content\":\"A string\",\"tags\":[ 1, \"a string\" ],\"body\":\"A string\",\"numComments\":1 }" \
https://parseapi.back4app.com/classes/Post

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Post = Parse.Object.extend('Post');
const myNewObject = new Post();

myNewObject.set('content', 'A string');
myNewObject.set('tags', [1, 'a string']);
myNewObject.set('body', 'A string');
myNewObject.set('numComments', 1);

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Post created: ${JSON.stringify(result)}`);
    console.log('Post created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Post: ${JSON.stringify(error)}`);
    console.error('Error while creating Post: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Post");

  entity.put("content", "A string");
  entity.put("tags", new JSONArray());
  entity.put("body", "A string");
  entity.put("numComments", 1);

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Post")

parseObject["content"] = "A string"
parseObject["tags"] = [1, "a string"]
parseObject["body"] = "A string"
parseObject["numComments"] = 1

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Post"];

parseObject[@"content"] = @"A string";
parseObject[@"tags"] = @[@1, @"a string"];
parseObject[@"body"] = @"A string";
parseObject[@"numComments"] = @1;

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Post");
myObject["content"] = "A string";
myObject["tags"] = new List<object>{1, "a string"};
myObject["body"] = "A string";
myObject["numComments"] = 1;
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Post");

$myCustomObject->set("content", "A string");
$myCustomObject->set("tags", [1, "a string"]);
$myCustomObject->set("body", "A string");
$myCustomObject->set("numComments", 1);

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Post',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Post class, you'll need to send a POST request to the Post class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Post

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Post/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"content\":\"A string\",\"tags\":[ 1, \"a string\" ],\"body\":\"A string\",\"numComments\":1 }" \
https://parseapi.back4app.com/classes/Post

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "content": \"A string\","tags": [ 1, \"a string\" ],"body": \"A string\","numComments": 1
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "content": \"A string\","tags": [ 1, \"a string\" ],"body": \"A string\","numComments": 1
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "content": \"A string\","tags": [ 1, \"a string\" ],"body": \"A string\","numComments": 1
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Post = Parse.Object.extend('Post');
const query = new Parse.Query(Post);
query.equalTo("content", 'A string');
query.equalTo("tags", [1, 'a string']);
query.equalTo("body", 'A string');
query.equalTo("numComments", 1);
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Post found: ${JSON.stringify(results)}`);
  console.log('Post found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Post: ${JSON.stringify(error)}`);
  console.error('Error while fetching Post', error);
});

Example Output:

'A string' [1, 'a string'] 'A string' 1 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Post");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Post")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Post"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Post");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string content = result.Get<string>("content");
IList tags = result.Get<IList>("tags");
string body = result.Get<string>("body");
int numComments = result.Get<int>("numComments");
$query = new ParseQuery("Post");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $content = $myCustomObject->get("content");
  $tags = $myCustomObject->get("tags");
  $body = $myCustomObject->get("body");
  $numComments = $myCustomObject->get("numComments");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Post

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"content\": \"A string\",\"tags\": [ 1, \"a string\" ],\"body\": \"A string\",\"numComments\": 1 }" \
https://parseapi.back4app.com/classes/Post/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "content": {"__op":"Delete"},"tags": {"__op":"Delete"},"body": {"__op":"Delete"},"numComments": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Post

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Post = Parse.Object.extend('Post');
const query = new Parse.Query(Post);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('content', 'A string');
  object.set('tags', [1, 'a string']);
  object.set('body', 'A string');
  object.set('numComments', 1);
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Post: ${JSON.stringify(response)}`);
    console.log('Updated Post', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Post: ${JSON.stringify(error)}`);
    console.error('Error while updating Post', error);
  });
});

Example Output:

ParseObjectSubclass { className: Post, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Post = Parse.Object.extend('Post');
const query = new Parse.Query(Post);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Post: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Post: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Post', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Post");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("content", "A string");
        entity.put("tags", new JSONArray());
        entity.put("body", "A string");
        entity.put("numComments", 1);

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Post")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["content"] = "A string"
    parseObject["tags"] = [1, "a string"]
    parseObject["body"] = "A string"
    parseObject["numComments"] = 1

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Post"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"content"] = @"A string";
    parseObject[@"tags"] = @[@1, @"a string"];
    parseObject[@"body"] = @"A string";
    parseObject[@"numComments"] = @1;

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Post");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["content"] = "A string";
myObject["tags"] = new List<object>{1, "a string"};
myObject["body"] = "A string";
myObject["numComments"] = 1;
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("content");
myObject.Remove("tags");
myObject.Remove("body");
myObject.Remove("numComments");
await myObject.SaveAsync();
$query = new ParseQuery("Post");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("content", "A string");
  $myCustomObject->set("tags", [1, "a string"]);
  $myCustomObject->set("body", "A string");
  $myCustomObject->set("numComments", 1);

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Post/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Post/<OBJECT_ID>

Example Response:

{}

Code:

const Post = Parse.Object.extend('Post');
const query = new Parse.Query(Post);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Post: ${JSON.stringify(response)}`);
    console.log('Deleted Post', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Post: ${JSON.stringify(error)}`);
    console.error('Error while deleting Post', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Post', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Post");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("content");
          entity.remove("tags");
          entity.remove("body");
          entity.remove("numComments");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Post")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("content")
      parseObject.removeObjectForKey("tags")
      parseObject.removeObjectForKey("body")
      parseObject.removeObjectForKey("numComments")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Post"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"content"];
  // [parseObject removeObjectForKey:@"tags"];
  // [parseObject removeObjectForKey:@"body"];
  // [parseObject removeObjectForKey:@"numComments"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Post");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Post");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("content");
  $myCustomObject->delete("tags");
  $myCustomObject->delete("body");
  $myCustomObject->delete("numComments");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Post/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Comment Class

Example JSON:

{
  "content": "A string",
  "post": { "__type": "Pointer", "className": "Post", "objectId": "<THE_REFERENCED_OBJECT_ID>" }
}

Comment is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Comment

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
content String "A string"
post Pointer { "__type": "Pointer", "className": "Post", "objectId": "<THE_REFERENCED_OBJECT_ID>" }

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"content\":\"A string\",\"post\":{ \"__type\": \"Pointer\", \"className\": \"Post\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Comment

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Comment = Parse.Object.extend('Comment');
const myNewObject = new Comment();

myNewObject.set('content', 'A string');
myNewObject.set('post', new Parse.Object("Post"));

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Comment created: ${JSON.stringify(result)}`);
    console.log('Comment created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Comment: ${JSON.stringify(error)}`);
    console.error('Error while creating Comment: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Comment");

  entity.put("content", "A string");
  entity.put("post", new ParseObject("Post"));

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Comment")

parseObject["content"] = "A string"
parseObject["post"] = PFObject(className:"Post")

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Comment"];

parseObject[@"content"] = @"A string";
parseObject[@"post"] = [PFObject objectWithClassName:@"Post"];

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Comment");
myObject["content"] = "A string";
myObject["post"] = new ParseObject("Post");
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Comment");

$myCustomObject->set("content", "A string");
$myCustomObject->set("post", new ParseObject("Post"));

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Comment',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Comment class, you'll need to send a POST request to the Comment class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Comment

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Comment/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"content\":\"A string\",\"post\":{ \"__type\": \"Pointer\", \"className\": \"Post\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Comment

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "content": \"A string\","post": { \"__type\": \"Pointer\", \"className\": \"Post\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "content": \"A string\","post": { \"__type\": \"Pointer\", \"className\": \"Post\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "content": \"A string\","post": { \"__type\": \"Pointer\", \"className\": \"Post\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Comment = Parse.Object.extend('Comment');
const query = new Parse.Query(Comment);
query.equalTo("content", 'A string');
query.equalTo("post", new Parse.Object("Post"));
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Comment found: ${JSON.stringify(results)}`);
  console.log('Comment found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Comment: ${JSON.stringify(error)}`);
  console.error('Error while fetching Comment', error);
});

Example Output:

'A string' new Parse.Object("Post") 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Comment");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Comment")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Comment"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Comment");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string content = result.Get<string>("content");
ParseObject post = result.Get<ParseObject>("post");
$query = new ParseQuery("Comment");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $content = $myCustomObject->get("content");
  $post = $myCustomObject->get("post");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Comment

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"content\": \"A string\",\"post\": { \"__type\": \"Pointer\", \"className\": \"Post\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Comment/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "content": {"__op":"Delete"},"post": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Comment

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Comment = Parse.Object.extend('Comment');
const query = new Parse.Query(Comment);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('content', 'A string');
  object.set('post', new Parse.Object("Post"));
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Comment: ${JSON.stringify(response)}`);
    console.log('Updated Comment', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Comment: ${JSON.stringify(error)}`);
    console.error('Error while updating Comment', error);
  });
});

Example Output:

ParseObjectSubclass { className: Comment, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Comment = Parse.Object.extend('Comment');
const query = new Parse.Query(Comment);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Comment: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Comment: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Comment', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Comment");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("content", "A string");
        entity.put("post", new ParseObject("Post"));

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Comment")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["content"] = "A string"
    parseObject["post"] = PFObject(className:"Post")

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Comment"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"content"] = @"A string";
    parseObject[@"post"] = [PFObject objectWithClassName:@"Post"];

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Comment");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["content"] = "A string";
myObject["post"] = new ParseObject("Post");
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("content");
myObject.Remove("post");
await myObject.SaveAsync();
$query = new ParseQuery("Comment");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("content", "A string");
  $myCustomObject->set("post", new ParseObject("Post"));

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Comment/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Comment/<OBJECT_ID>

Example Response:

{}

Code:

const Comment = Parse.Object.extend('Comment');
const query = new Parse.Query(Comment);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Comment: ${JSON.stringify(response)}`);
    console.log('Deleted Comment', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Comment: ${JSON.stringify(error)}`);
    console.error('Error while deleting Comment', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Comment', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Comment");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("content");
          entity.remove("post");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Comment")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("content")
      parseObject.removeObjectForKey("post")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Comment"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"content"];
  // [parseObject removeObjectForKey:@"post"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Comment");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Comment");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("content");
  $myCustomObject->delete("post");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Comment/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Recenzie Class

Example JSON:

{
  "myCustomKey1Name": "A string",
  "myCustomKey2Name": "A string"
}

Recenzie is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Recenzie

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
myCustomKey1Name String "A string"
myCustomKey2Name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Recenzie

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Recenzie = Parse.Object.extend('Recenzie');
const myNewObject = new Recenzie();

myNewObject.set('myCustomKey1Name', 'A string');
myNewObject.set('myCustomKey2Name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Recenzie created: ${JSON.stringify(result)}`);
    console.log('Recenzie created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Recenzie: ${JSON.stringify(error)}`);
    console.error('Error while creating Recenzie: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Recenzie");

  entity.put("myCustomKey1Name", "A string");
  entity.put("myCustomKey2Name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Recenzie")

parseObject["myCustomKey1Name"] = "A string"
parseObject["myCustomKey2Name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Recenzie"];

parseObject[@"myCustomKey1Name"] = @"A string";
parseObject[@"myCustomKey2Name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Recenzie");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Recenzie");

$myCustomObject->set("myCustomKey1Name", "A string");
$myCustomObject->set("myCustomKey2Name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Recenzie',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Recenzie class, you'll need to send a POST request to the Recenzie class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Recenzie

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Recenzie/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Recenzie

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Recenzie = Parse.Object.extend('Recenzie');
const query = new Parse.Query(Recenzie);
query.equalTo("myCustomKey1Name", 'A string');
query.equalTo("myCustomKey2Name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Recenzie found: ${JSON.stringify(results)}`);
  console.log('Recenzie found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Recenzie: ${JSON.stringify(error)}`);
  console.error('Error while fetching Recenzie', error);
});

Example Output:

'A string' 'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Recenzie");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Recenzie")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Recenzie"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Recenzie");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string myCustomKey1Name = result.Get<string>("myCustomKey1Name");
string myCustomKey2Name = result.Get<string>("myCustomKey2Name");
$query = new ParseQuery("Recenzie");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $myCustomKey1Name = $myCustomObject->get("myCustomKey1Name");
  $myCustomKey2Name = $myCustomObject->get("myCustomKey2Name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Recenzie

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\": \"A string\",\"myCustomKey2Name\": \"A string\" }" \
https://parseapi.back4app.com/classes/Recenzie/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "myCustomKey1Name": {"__op":"Delete"},"myCustomKey2Name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Recenzie

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Recenzie = Parse.Object.extend('Recenzie');
const query = new Parse.Query(Recenzie);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('myCustomKey1Name', 'A string');
  object.set('myCustomKey2Name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Recenzie: ${JSON.stringify(response)}`);
    console.log('Updated Recenzie', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Recenzie: ${JSON.stringify(error)}`);
    console.error('Error while updating Recenzie', error);
  });
});

Example Output:

ParseObjectSubclass { className: Recenzie, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Recenzie = Parse.Object.extend('Recenzie');
const query = new Parse.Query(Recenzie);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Recenzie: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Recenzie: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Recenzie', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Recenzie");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("myCustomKey1Name", "A string");
        entity.put("myCustomKey2Name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Recenzie")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["myCustomKey1Name"] = "A string"
    parseObject["myCustomKey2Name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Recenzie"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"myCustomKey1Name"] = @"A string";
    parseObject[@"myCustomKey2Name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Recenzie");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("myCustomKey1Name");
myObject.Remove("myCustomKey2Name");
await myObject.SaveAsync();
$query = new ParseQuery("Recenzie");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("myCustomKey1Name", "A string");
  $myCustomObject->set("myCustomKey2Name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Recenzie/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Recenzie/<OBJECT_ID>

Example Response:

{}

Code:

const Recenzie = Parse.Object.extend('Recenzie');
const query = new Parse.Query(Recenzie);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Recenzie: ${JSON.stringify(response)}`);
    console.log('Deleted Recenzie', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Recenzie: ${JSON.stringify(error)}`);
    console.error('Error while deleting Recenzie', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Recenzie', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Recenzie");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("myCustomKey1Name");
          entity.remove("myCustomKey2Name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Recenzie")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("myCustomKey1Name")
      parseObject.removeObjectForKey("myCustomKey2Name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Recenzie"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"myCustomKey1Name"];
  // [parseObject removeObjectForKey:@"myCustomKey2Name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Recenzie");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Recenzie");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("myCustomKey1Name");
  $myCustomObject->delete("myCustomKey2Name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Recenzie/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

aaaa Class

Example JSON:

{
  "clo1": "A string"
}

aaaa is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/aaaa

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
clo1 String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"clo1\":\"A string\" }" \
https://parseapi.back4app.com/classes/aaaa

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const aaaa = Parse.Object.extend('aaaa');
const myNewObject = new aaaa();

myNewObject.set('clo1', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`aaaa created: ${JSON.stringify(result)}`);
    console.log('aaaa created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating aaaa: ${JSON.stringify(error)}`);
    console.error('Error while creating aaaa: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("aaaa");

  entity.put("clo1", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"aaaa")

parseObject["clo1"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"aaaa"];

parseObject[@"clo1"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("aaaa");
myObject["clo1"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("aaaa");

$myCustomObject->set("clo1", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'aaaa',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the aaaa class, you'll need to send a POST request to the aaaa class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/aaaa

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/aaaa/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"clo1\":\"A string\" }" \
https://parseapi.back4app.com/classes/aaaa

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "clo1": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "clo1": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "clo1": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const aaaa = Parse.Object.extend('aaaa');
const query = new Parse.Query(aaaa);
query.equalTo("clo1", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`aaaa found: ${JSON.stringify(results)}`);
  console.log('aaaa found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching aaaa: ${JSON.stringify(error)}`);
  console.error('Error while fetching aaaa', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("aaaa");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"aaaa")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"aaaa"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("aaaa");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string clo1 = result.Get<string>("clo1");
$query = new ParseQuery("aaaa");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $clo1 = $myCustomObject->get("clo1");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/aaaa

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"clo1\": \"A string\" }" \
https://parseapi.back4app.com/classes/aaaa/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "clo1": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/aaaa

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const aaaa = Parse.Object.extend('aaaa');
const query = new Parse.Query(aaaa);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('clo1', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated aaaa: ${JSON.stringify(response)}`);
    console.log('Updated aaaa', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating aaaa: ${JSON.stringify(error)}`);
    console.error('Error while updating aaaa', error);
  });
});

Example Output:

ParseObjectSubclass { className: aaaa, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const aaaa = Parse.Object.extend('aaaa');
const query = new Parse.Query(aaaa);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated aaaa: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating aaaa: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'aaaa', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("aaaa");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("clo1", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"aaaa")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["clo1"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"aaaa"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"clo1"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("aaaa");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["clo1"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("clo1");
await myObject.SaveAsync();
$query = new ParseQuery("aaaa");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("clo1", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/aaaa/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/aaaa/<OBJECT_ID>

Example Response:

{}

Code:

const aaaa = Parse.Object.extend('aaaa');
const query = new Parse.Query(aaaa);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted aaaa: ${JSON.stringify(response)}`);
    console.log('Deleted aaaa', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting aaaa: ${JSON.stringify(error)}`);
    console.error('Error while deleting aaaa', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'aaaa', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("aaaa");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("clo1");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"aaaa")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("clo1")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"aaaa"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"clo1"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("aaaa");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("aaaa");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("clo1");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/aaaa/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Tent Class

Example JSON:

{
  "name": "A string"
}

Tent is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Tent

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Tent

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Tent = Parse.Object.extend('Tent');
const myNewObject = new Tent();

myNewObject.set('name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Tent created: ${JSON.stringify(result)}`);
    console.log('Tent created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Tent: ${JSON.stringify(error)}`);
    console.error('Error while creating Tent: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Tent");

  entity.put("name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Tent")

parseObject["name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Tent"];

parseObject[@"name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Tent");
myObject["name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Tent");

$myCustomObject->set("name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Tent',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Tent class, you'll need to send a POST request to the Tent class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Tent

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Tent/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Tent

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Tent = Parse.Object.extend('Tent');
const query = new Parse.Query(Tent);
query.equalTo("name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Tent found: ${JSON.stringify(results)}`);
  console.log('Tent found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Tent: ${JSON.stringify(error)}`);
  console.error('Error while fetching Tent', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Tent");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Tent")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Tent"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Tent");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string name = result.Get<string>("name");
$query = new ParseQuery("Tent");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $name = $myCustomObject->get("name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Tent

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\": \"A string\" }" \
https://parseapi.back4app.com/classes/Tent/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Tent

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Tent = Parse.Object.extend('Tent');
const query = new Parse.Query(Tent);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Tent: ${JSON.stringify(response)}`);
    console.log('Updated Tent', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Tent: ${JSON.stringify(error)}`);
    console.error('Error while updating Tent', error);
  });
});

Example Output:

ParseObjectSubclass { className: Tent, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Tent = Parse.Object.extend('Tent');
const query = new Parse.Query(Tent);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Tent: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Tent: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Tent', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Tent");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Tent")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Tent"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Tent");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("name");
await myObject.SaveAsync();
$query = new ParseQuery("Tent");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Tent/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Tent/<OBJECT_ID>

Example Response:

{}

Code:

const Tent = Parse.Object.extend('Tent');
const query = new Parse.Query(Tent);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Tent: ${JSON.stringify(response)}`);
    console.log('Deleted Tent', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Tent: ${JSON.stringify(error)}`);
    console.error('Error while deleting Tent', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Tent', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Tent");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Tent")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Tent"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Tent");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Tent");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Tent/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Deal Class

Example JSON:

{
  "Owner": { "foo": "bar" },
  "Smile_Advisers": [1, "a string"],
  "Lost_Reason": [1, "a string"],
  "Contacted": [1, "a string"],
  "Tag": [1, "a string"],
  "Modified_By": { "foo": "bar" },
  "Contact_Tags": [1, "a string"],
  "Prohibited_Treatment": true,
  "Address_Confirmed": true,
  "Reassign": true,
  "Chronic_Illness": true,
  "Currency": "A string",
  "Stage": "A string",
  "Country_Ops": "A string",
  "Bleeding_Teeth": true,
  "Created_Time": "A string",
  "CustomerId": "A string",
  "Bridges": true,
  "Diagnostic_Sent": true,
  "Loose_Teeth": true,
  "Invoiced": true,
  "Final_Price": 1,
  "move_to_nurturing": true,
  "Send_Payment_Link": true,
  "Dentist_Last_Year": true,
  "CreateLink": true,
  "Patient_Name": "A string",
  "Difficulty_Open_Mouth": true,
  "Group_Assigned": "A string",
  "Mouth_Noise": true,
  "Send_Checkout": true,
  "Patient_Tier": "A string",
  "Email": "A string",
  "Last_Activity_Time": "A string",
  "Deal_Name": "A string",
  "Exchange_Rate": 1,
  "Need_Medical_Treatment": true,
  "move_to_lost": true,
  "Terms_Accepted": true,
  "Need_To_Check": true,
  "Requiere_return": true,
  "Invoice_Required": true,
  "Dental_Cleaning": true,
  "Planning_Approved": true,
  "STL_Exported": true,
  "Prepaid_Not_Found": true,
  "Payment_Status": "A string",
  "Planning_Sent": true,
  "Phone": "A string",
  "Pictures_Uploaded": true,
  "STL_Uploaded": true,
  "Modified_Time": "A string",
  "Retainer": true,
  "No_Welcome_Message": true,
  "PaymentId": "A string",
  "Attended_Appointment": true,
  "Treatment": true,
  "No_Call": true,
  "Regular_Medicine": true
}

Deal is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Deal

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
Owner Object { "foo": "bar" }
Smile_Advisers Array [1, "a string"]
Lost_Reason Array [1, "a string"]
Contacted Array [1, "a string"]
Tag Array [1, "a string"]
Modified_By Object { "foo": "bar" }
Contact_Tags Array [1, "a string"]
Prohibited_Treatment Boolean true
Address_Confirmed Boolean true
Reassign Boolean true
Chronic_Illness Boolean true
Currency String "A string"
Stage String "A string"
Country_Ops String "A string"
Bleeding_Teeth Boolean true
Created_Time String "A string"
CustomerId String "A string"
Bridges Boolean true
Diagnostic_Sent Boolean true
Loose_Teeth Boolean true
Invoiced Boolean true
Final_Price Number 1
move_to_nurturing Boolean true
Send_Payment_Link Boolean true
Dentist_Last_Year Boolean true
CreateLink Boolean true
Patient_Name String "A string"
Difficulty_Open_Mouth Boolean true
Group_Assigned String "A string"
Mouth_Noise Boolean true
Send_Checkout Boolean true
Patient_Tier String "A string"
Email String "A string"
Last_Activity_Time String "A string"
Deal_Name String "A string"
Exchange_Rate Number 1
Need_Medical_Treatment Boolean true
move_to_lost Boolean true
Terms_Accepted Boolean true
Need_To_Check Boolean true
Requiere_return Boolean true
Invoice_Required Boolean true
Dental_Cleaning Boolean true
Planning_Approved Boolean true
STL_Exported Boolean true
Prepaid_Not_Found Boolean true
Payment_Status String "A string"
Planning_Sent Boolean true
Phone String "A string"
Pictures_Uploaded Boolean true
STL_Uploaded Boolean true
Modified_Time String "A string"
Retainer Boolean true
No_Welcome_Message Boolean true
PaymentId String "A string"
Attended_Appointment Boolean true
Treatment Boolean true
No_Call Boolean true
Regular_Medicine Boolean true

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"Owner\":{ \"foo\": \"bar\" },\"Smile_Advisers\":[ 1, \"a string\" ],\"Lost_Reason\":[ 1, \"a string\" ],\"Contacted\":[ 1, \"a string\" ],\"Tag\":[ 1, \"a string\" ],\"Modified_By\":{ \"foo\": \"bar\" },\"Contact_Tags\":[ 1, \"a string\" ],\"Prohibited_Treatment\":true,\"Address_Confirmed\":true,\"Reassign\":true,\"Chronic_Illness\":true,\"Currency\":\"A string\",\"Stage\":\"A string\",\"Country_Ops\":\"A string\",\"Bleeding_Teeth\":true,\"Created_Time\":\"A string\",\"CustomerId\":\"A string\",\"Bridges\":true,\"Diagnostic_Sent\":true,\"Loose_Teeth\":true,\"Invoiced\":true,\"Final_Price\":1,\"move_to_nurturing\":true,\"Send_Payment_Link\":true,\"Dentist_Last_Year\":true,\"CreateLink\":true,\"Patient_Name\":\"A string\",\"Difficulty_Open_Mouth\":true,\"Group_Assigned\":\"A string\",\"Mouth_Noise\":true,\"Send_Checkout\":true,\"Patient_Tier\":\"A string\",\"Email\":\"A string\",\"Last_Activity_Time\":\"A string\",\"Deal_Name\":\"A string\",\"Exchange_Rate\":1,\"Need_Medical_Treatment\":true,\"move_to_lost\":true,\"Terms_Accepted\":true,\"Need_To_Check\":true,\"Requiere_return\":true,\"Invoice_Required\":true,\"Dental_Cleaning\":true,\"Planning_Approved\":true,\"STL_Exported\":true,\"Prepaid_Not_Found\":true,\"Payment_Status\":\"A string\",\"Planning_Sent\":true,\"Phone\":\"A string\",\"Pictures_Uploaded\":true,\"STL_Uploaded\":true,\"Modified_Time\":\"A string\",\"Retainer\":true,\"No_Welcome_Message\":true,\"PaymentId\":\"A string\",\"Attended_Appointment\":true,\"Treatment\":true,\"No_Call\":true,\"Regular_Medicine\":true }" \
https://parseapi.back4app.com/classes/Deal

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Deal = Parse.Object.extend('Deal');
const myNewObject = new Deal();

myNewObject.set('Owner', { foo: 'bar' });
myNewObject.set('Smile_Advisers', [1, 'a string']);
myNewObject.set('Lost_Reason', [1, 'a string']);
myNewObject.set('Contacted', [1, 'a string']);
myNewObject.set('Tag', [1, 'a string']);
myNewObject.set('Modified_By', { foo: 'bar' });
myNewObject.set('Contact_Tags', [1, 'a string']);
myNewObject.set('Prohibited_Treatment', true);
myNewObject.set('Address_Confirmed', true);
myNewObject.set('Reassign', true);
myNewObject.set('Chronic_Illness', true);
myNewObject.set('Currency', 'A string');
myNewObject.set('Stage', 'A string');
myNewObject.set('Country_Ops', 'A string');
myNewObject.set('Bleeding_Teeth', true);
myNewObject.set('Created_Time', 'A string');
myNewObject.set('CustomerId', 'A string');
myNewObject.set('Bridges', true);
myNewObject.set('Diagnostic_Sent', true);
myNewObject.set('Loose_Teeth', true);
myNewObject.set('Invoiced', true);
myNewObject.set('Final_Price', 1);
myNewObject.set('move_to_nurturing', true);
myNewObject.set('Send_Payment_Link', true);
myNewObject.set('Dentist_Last_Year', true);
myNewObject.set('CreateLink', true);
myNewObject.set('Patient_Name', 'A string');
myNewObject.set('Difficulty_Open_Mouth', true);
myNewObject.set('Group_Assigned', 'A string');
myNewObject.set('Mouth_Noise', true);
myNewObject.set('Send_Checkout', true);
myNewObject.set('Patient_Tier', 'A string');
myNewObject.set('Email', 'A string');
myNewObject.set('Last_Activity_Time', 'A string');
myNewObject.set('Deal_Name', 'A string');
myNewObject.set('Exchange_Rate', 1);
myNewObject.set('Need_Medical_Treatment', true);
myNewObject.set('move_to_lost', true);
myNewObject.set('Terms_Accepted', true);
myNewObject.set('Need_To_Check', true);
myNewObject.set('Requiere_return', true);
myNewObject.set('Invoice_Required', true);
myNewObject.set('Dental_Cleaning', true);
myNewObject.set('Planning_Approved', true);
myNewObject.set('STL_Exported', true);
myNewObject.set('Prepaid_Not_Found', true);
myNewObject.set('Payment_Status', 'A string');
myNewObject.set('Planning_Sent', true);
myNewObject.set('Phone', 'A string');
myNewObject.set('Pictures_Uploaded', true);
myNewObject.set('STL_Uploaded', true);
myNewObject.set('Modified_Time', 'A string');
myNewObject.set('Retainer', true);
myNewObject.set('No_Welcome_Message', true);
myNewObject.set('PaymentId', 'A string');
myNewObject.set('Attended_Appointment', true);
myNewObject.set('Treatment', true);
myNewObject.set('No_Call', true);
myNewObject.set('Regular_Medicine', true);

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Deal created: ${JSON.stringify(result)}`);
    console.log('Deal created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Deal: ${JSON.stringify(error)}`);
    console.error('Error while creating Deal: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Deal");

  entity.put("Owner", new JSONObject());
  entity.put("Smile_Advisers", new JSONArray());
  entity.put("Lost_Reason", new JSONArray());
  entity.put("Contacted", new JSONArray());
  entity.put("Tag", new JSONArray());
  entity.put("Modified_By", new JSONObject());
  entity.put("Contact_Tags", new JSONArray());
  entity.put("Prohibited_Treatment", true);
  entity.put("Address_Confirmed", true);
  entity.put("Reassign", true);
  entity.put("Chronic_Illness", true);
  entity.put("Currency", "A string");
  entity.put("Stage", "A string");
  entity.put("Country_Ops", "A string");
  entity.put("Bleeding_Teeth", true);
  entity.put("Created_Time", "A string");
  entity.put("CustomerId", "A string");
  entity.put("Bridges", true);
  entity.put("Diagnostic_Sent", true);
  entity.put("Loose_Teeth", true);
  entity.put("Invoiced", true);
  entity.put("Final_Price", 1);
  entity.put("move_to_nurturing", true);
  entity.put("Send_Payment_Link", true);
  entity.put("Dentist_Last_Year", true);
  entity.put("CreateLink", true);
  entity.put("Patient_Name", "A string");
  entity.put("Difficulty_Open_Mouth", true);
  entity.put("Group_Assigned", "A string");
  entity.put("Mouth_Noise", true);
  entity.put("Send_Checkout", true);
  entity.put("Patient_Tier", "A string");
  entity.put("Email", "A string");
  entity.put("Last_Activity_Time", "A string");
  entity.put("Deal_Name", "A string");
  entity.put("Exchange_Rate", 1);
  entity.put("Need_Medical_Treatment", true);
  entity.put("move_to_lost", true);
  entity.put("Terms_Accepted", true);
  entity.put("Need_To_Check", true);
  entity.put("Requiere_return", true);
  entity.put("Invoice_Required", true);
  entity.put("Dental_Cleaning", true);
  entity.put("Planning_Approved", true);
  entity.put("STL_Exported", true);
  entity.put("Prepaid_Not_Found", true);
  entity.put("Payment_Status", "A string");
  entity.put("Planning_Sent", true);
  entity.put("Phone", "A string");
  entity.put("Pictures_Uploaded", true);
  entity.put("STL_Uploaded", true);
  entity.put("Modified_Time", "A string");
  entity.put("Retainer", true);
  entity.put("No_Welcome_Message", true);
  entity.put("PaymentId", "A string");
  entity.put("Attended_Appointment", true);
  entity.put("Treatment", true);
  entity.put("No_Call", true);
  entity.put("Regular_Medicine", true);

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Deal")

parseObject["Owner"] = [ "foo": "bar" ]
parseObject["Smile_Advisers"] = [1, "a string"]
parseObject["Lost_Reason"] = [1, "a string"]
parseObject["Contacted"] = [1, "a string"]
parseObject["Tag"] = [1, "a string"]
parseObject["Modified_By"] = [ "foo": "bar" ]
parseObject["Contact_Tags"] = [1, "a string"]
parseObject["Prohibited_Treatment"] = true
parseObject["Address_Confirmed"] = true
parseObject["Reassign"] = true
parseObject["Chronic_Illness"] = true
parseObject["Currency"] = "A string"
parseObject["Stage"] = "A string"
parseObject["Country_Ops"] = "A string"
parseObject["Bleeding_Teeth"] = true
parseObject["Created_Time"] = "A string"
parseObject["CustomerId"] = "A string"
parseObject["Bridges"] = true
parseObject["Diagnostic_Sent"] = true
parseObject["Loose_Teeth"] = true
parseObject["Invoiced"] = true
parseObject["Final_Price"] = 1
parseObject["move_to_nurturing"] = true
parseObject["Send_Payment_Link"] = true
parseObject["Dentist_Last_Year"] = true
parseObject["CreateLink"] = true
parseObject["Patient_Name"] = "A string"
parseObject["Difficulty_Open_Mouth"] = true
parseObject["Group_Assigned"] = "A string"
parseObject["Mouth_Noise"] = true
parseObject["Send_Checkout"] = true
parseObject["Patient_Tier"] = "A string"
parseObject["Email"] = "A string"
parseObject["Last_Activity_Time"] = "A string"
parseObject["Deal_Name"] = "A string"
parseObject["Exchange_Rate"] = 1
parseObject["Need_Medical_Treatment"] = true
parseObject["move_to_lost"] = true
parseObject["Terms_Accepted"] = true
parseObject["Need_To_Check"] = true
parseObject["Requiere_return"] = true
parseObject["Invoice_Required"] = true
parseObject["Dental_Cleaning"] = true
parseObject["Planning_Approved"] = true
parseObject["STL_Exported"] = true
parseObject["Prepaid_Not_Found"] = true
parseObject["Payment_Status"] = "A string"
parseObject["Planning_Sent"] = true
parseObject["Phone"] = "A string"
parseObject["Pictures_Uploaded"] = true
parseObject["STL_Uploaded"] = true
parseObject["Modified_Time"] = "A string"
parseObject["Retainer"] = true
parseObject["No_Welcome_Message"] = true
parseObject["PaymentId"] = "A string"
parseObject["Attended_Appointment"] = true
parseObject["Treatment"] = true
parseObject["No_Call"] = true
parseObject["Regular_Medicine"] = true

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Deal"];

parseObject[@"Owner"] = @{ @"foo": @"bar" };
parseObject[@"Smile_Advisers"] = @[@1, @"a string"];
parseObject[@"Lost_Reason"] = @[@1, @"a string"];
parseObject[@"Contacted"] = @[@1, @"a string"];
parseObject[@"Tag"] = @[@1, @"a string"];
parseObject[@"Modified_By"] = @{ @"foo": @"bar" };
parseObject[@"Contact_Tags"] = @[@1, @"a string"];
parseObject[@"Prohibited_Treatment"] = @YES;
parseObject[@"Address_Confirmed"] = @YES;
parseObject[@"Reassign"] = @YES;
parseObject[@"Chronic_Illness"] = @YES;
parseObject[@"Currency"] = @"A string";
parseObject[@"Stage"] = @"A string";
parseObject[@"Country_Ops"] = @"A string";
parseObject[@"Bleeding_Teeth"] = @YES;
parseObject[@"Created_Time"] = @"A string";
parseObject[@"CustomerId"] = @"A string";
parseObject[@"Bridges"] = @YES;
parseObject[@"Diagnostic_Sent"] = @YES;
parseObject[@"Loose_Teeth"] = @YES;
parseObject[@"Invoiced"] = @YES;
parseObject[@"Final_Price"] = @1;
parseObject[@"move_to_nurturing"] = @YES;
parseObject[@"Send_Payment_Link"] = @YES;
parseObject[@"Dentist_Last_Year"] = @YES;
parseObject[@"CreateLink"] = @YES;
parseObject[@"Patient_Name"] = @"A string";
parseObject[@"Difficulty_Open_Mouth"] = @YES;
parseObject[@"Group_Assigned"] = @"A string";
parseObject[@"Mouth_Noise"] = @YES;
parseObject[@"Send_Checkout"] = @YES;
parseObject[@"Patient_Tier"] = @"A string";
parseObject[@"Email"] = @"A string";
parseObject[@"Last_Activity_Time"] = @"A string";
parseObject[@"Deal_Name"] = @"A string";
parseObject[@"Exchange_Rate"] = @1;
parseObject[@"Need_Medical_Treatment"] = @YES;
parseObject[@"move_to_lost"] = @YES;
parseObject[@"Terms_Accepted"] = @YES;
parseObject[@"Need_To_Check"] = @YES;
parseObject[@"Requiere_return"] = @YES;
parseObject[@"Invoice_Required"] = @YES;
parseObject[@"Dental_Cleaning"] = @YES;
parseObject[@"Planning_Approved"] = @YES;
parseObject[@"STL_Exported"] = @YES;
parseObject[@"Prepaid_Not_Found"] = @YES;
parseObject[@"Payment_Status"] = @"A string";
parseObject[@"Planning_Sent"] = @YES;
parseObject[@"Phone"] = @"A string";
parseObject[@"Pictures_Uploaded"] = @YES;
parseObject[@"STL_Uploaded"] = @YES;
parseObject[@"Modified_Time"] = @"A string";
parseObject[@"Retainer"] = @YES;
parseObject[@"No_Welcome_Message"] = @YES;
parseObject[@"PaymentId"] = @"A string";
parseObject[@"Attended_Appointment"] = @YES;
parseObject[@"Treatment"] = @YES;
parseObject[@"No_Call"] = @YES;
parseObject[@"Regular_Medicine"] = @YES;

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Deal");
myObject["Owner"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["Smile_Advisers"] = new List<object>{1, "a string"};
myObject["Lost_Reason"] = new List<object>{1, "a string"};
myObject["Contacted"] = new List<object>{1, "a string"};
myObject["Tag"] = new List<object>{1, "a string"};
myObject["Modified_By"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["Contact_Tags"] = new List<object>{1, "a string"};
myObject["Prohibited_Treatment"] = true;
myObject["Address_Confirmed"] = true;
myObject["Reassign"] = true;
myObject["Chronic_Illness"] = true;
myObject["Currency"] = "A string";
myObject["Stage"] = "A string";
myObject["Country_Ops"] = "A string";
myObject["Bleeding_Teeth"] = true;
myObject["Created_Time"] = "A string";
myObject["CustomerId"] = "A string";
myObject["Bridges"] = true;
myObject["Diagnostic_Sent"] = true;
myObject["Loose_Teeth"] = true;
myObject["Invoiced"] = true;
myObject["Final_Price"] = 1;
myObject["move_to_nurturing"] = true;
myObject["Send_Payment_Link"] = true;
myObject["Dentist_Last_Year"] = true;
myObject["CreateLink"] = true;
myObject["Patient_Name"] = "A string";
myObject["Difficulty_Open_Mouth"] = true;
myObject["Group_Assigned"] = "A string";
myObject["Mouth_Noise"] = true;
myObject["Send_Checkout"] = true;
myObject["Patient_Tier"] = "A string";
myObject["Email"] = "A string";
myObject["Last_Activity_Time"] = "A string";
myObject["Deal_Name"] = "A string";
myObject["Exchange_Rate"] = 1;
myObject["Need_Medical_Treatment"] = true;
myObject["move_to_lost"] = true;
myObject["Terms_Accepted"] = true;
myObject["Need_To_Check"] = true;
myObject["Requiere_return"] = true;
myObject["Invoice_Required"] = true;
myObject["Dental_Cleaning"] = true;
myObject["Planning_Approved"] = true;
myObject["STL_Exported"] = true;
myObject["Prepaid_Not_Found"] = true;
myObject["Payment_Status"] = "A string";
myObject["Planning_Sent"] = true;
myObject["Phone"] = "A string";
myObject["Pictures_Uploaded"] = true;
myObject["STL_Uploaded"] = true;
myObject["Modified_Time"] = "A string";
myObject["Retainer"] = true;
myObject["No_Welcome_Message"] = true;
myObject["PaymentId"] = "A string";
myObject["Attended_Appointment"] = true;
myObject["Treatment"] = true;
myObject["No_Call"] = true;
myObject["Regular_Medicine"] = true;
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Deal");

$myCustomObject->set("Owner", ["foo" => "bar"]);
$myCustomObject->set("Smile_Advisers", [1, "a string"]);
$myCustomObject->set("Lost_Reason", [1, "a string"]);
$myCustomObject->set("Contacted", [1, "a string"]);
$myCustomObject->set("Tag", [1, "a string"]);
$myCustomObject->set("Modified_By", ["foo" => "bar"]);
$myCustomObject->set("Contact_Tags", [1, "a string"]);
$myCustomObject->set("Prohibited_Treatment", true);
$myCustomObject->set("Address_Confirmed", true);
$myCustomObject->set("Reassign", true);
$myCustomObject->set("Chronic_Illness", true);
$myCustomObject->set("Currency", "A string");
$myCustomObject->set("Stage", "A string");
$myCustomObject->set("Country_Ops", "A string");
$myCustomObject->set("Bleeding_Teeth", true);
$myCustomObject->set("Created_Time", "A string");
$myCustomObject->set("CustomerId", "A string");
$myCustomObject->set("Bridges", true);
$myCustomObject->set("Diagnostic_Sent", true);
$myCustomObject->set("Loose_Teeth", true);
$myCustomObject->set("Invoiced", true);
$myCustomObject->set("Final_Price", 1);
$myCustomObject->set("move_to_nurturing", true);
$myCustomObject->set("Send_Payment_Link", true);
$myCustomObject->set("Dentist_Last_Year", true);
$myCustomObject->set("CreateLink", true);
$myCustomObject->set("Patient_Name", "A string");
$myCustomObject->set("Difficulty_Open_Mouth", true);
$myCustomObject->set("Group_Assigned", "A string");
$myCustomObject->set("Mouth_Noise", true);
$myCustomObject->set("Send_Checkout", true);
$myCustomObject->set("Patient_Tier", "A string");
$myCustomObject->set("Email", "A string");
$myCustomObject->set("Last_Activity_Time", "A string");
$myCustomObject->set("Deal_Name", "A string");
$myCustomObject->set("Exchange_Rate", 1);
$myCustomObject->set("Need_Medical_Treatment", true);
$myCustomObject->set("move_to_lost", true);
$myCustomObject->set("Terms_Accepted", true);
$myCustomObject->set("Need_To_Check", true);
$myCustomObject->set("Requiere_return", true);
$myCustomObject->set("Invoice_Required", true);
$myCustomObject->set("Dental_Cleaning", true);
$myCustomObject->set("Planning_Approved", true);
$myCustomObject->set("STL_Exported", true);
$myCustomObject->set("Prepaid_Not_Found", true);
$myCustomObject->set("Payment_Status", "A string");
$myCustomObject->set("Planning_Sent", true);
$myCustomObject->set("Phone", "A string");
$myCustomObject->set("Pictures_Uploaded", true);
$myCustomObject->set("STL_Uploaded", true);
$myCustomObject->set("Modified_Time", "A string");
$myCustomObject->set("Retainer", true);
$myCustomObject->set("No_Welcome_Message", true);
$myCustomObject->set("PaymentId", "A string");
$myCustomObject->set("Attended_Appointment", true);
$myCustomObject->set("Treatment", true);
$myCustomObject->set("No_Call", true);
$myCustomObject->set("Regular_Medicine", true);

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Deal',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Deal class, you'll need to send a POST request to the Deal class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Deal

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Deal/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"Owner.foo\":\"bar\",\"Smile_Advisers\":[ 1, \"a string\" ],\"Lost_Reason\":[ 1, \"a string\" ],\"Contacted\":[ 1, \"a string\" ],\"Tag\":[ 1, \"a string\" ],\"Modified_By.foo\":\"bar\",\"Contact_Tags\":[ 1, \"a string\" ],\"Prohibited_Treatment\":true,\"Address_Confirmed\":true,\"Reassign\":true,\"Chronic_Illness\":true,\"Currency\":\"A string\",\"Stage\":\"A string\",\"Country_Ops\":\"A string\",\"Bleeding_Teeth\":true,\"Created_Time\":\"A string\",\"CustomerId\":\"A string\",\"Bridges\":true,\"Diagnostic_Sent\":true,\"Loose_Teeth\":true,\"Invoiced\":true,\"Final_Price\":1,\"move_to_nurturing\":true,\"Send_Payment_Link\":true,\"Dentist_Last_Year\":true,\"CreateLink\":true,\"Patient_Name\":\"A string\",\"Difficulty_Open_Mouth\":true,\"Group_Assigned\":\"A string\",\"Mouth_Noise\":true,\"Send_Checkout\":true,\"Patient_Tier\":\"A string\",\"Email\":\"A string\",\"Last_Activity_Time\":\"A string\",\"Deal_Name\":\"A string\",\"Exchange_Rate\":1,\"Need_Medical_Treatment\":true,\"move_to_lost\":true,\"Terms_Accepted\":true,\"Need_To_Check\":true,\"Requiere_return\":true,\"Invoice_Required\":true,\"Dental_Cleaning\":true,\"Planning_Approved\":true,\"STL_Exported\":true,\"Prepaid_Not_Found\":true,\"Payment_Status\":\"A string\",\"Planning_Sent\":true,\"Phone\":\"A string\",\"Pictures_Uploaded\":true,\"STL_Uploaded\":true,\"Modified_Time\":\"A string\",\"Retainer\":true,\"No_Welcome_Message\":true,\"PaymentId\":\"A string\",\"Attended_Appointment\":true,\"Treatment\":true,\"No_Call\":true,\"Regular_Medicine\":true }" \
https://parseapi.back4app.com/classes/Deal

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "Owner": { \"foo\": \"bar\" },"Smile_Advisers": [ 1, \"a string\" ],"Lost_Reason": [ 1, \"a string\" ],"Contacted": [ 1, \"a string\" ],"Tag": [ 1, \"a string\" ],"Modified_By": { \"foo\": \"bar\" },"Contact_Tags": [ 1, \"a string\" ],"Prohibited_Treatment": true,"Address_Confirmed": true,"Reassign": true,"Chronic_Illness": true,"Currency": \"A string\","Stage": \"A string\","Country_Ops": \"A string\","Bleeding_Teeth": true,"Created_Time": \"A string\","CustomerId": \"A string\","Bridges": true,"Diagnostic_Sent": true,"Loose_Teeth": true,"Invoiced": true,"Final_Price": 1,"move_to_nurturing": true,"Send_Payment_Link": true,"Dentist_Last_Year": true,"CreateLink": true,"Patient_Name": \"A string\","Difficulty_Open_Mouth": true,"Group_Assigned": \"A string\","Mouth_Noise": true,"Send_Checkout": true,"Patient_Tier": \"A string\","Email": \"A string\","Last_Activity_Time": \"A string\","Deal_Name": \"A string\","Exchange_Rate": 1,"Need_Medical_Treatment": true,"move_to_lost": true,"Terms_Accepted": true,"Need_To_Check": true,"Requiere_return": true,"Invoice_Required": true,"Dental_Cleaning": true,"Planning_Approved": true,"STL_Exported": true,"Prepaid_Not_Found": true,"Payment_Status": \"A string\","Planning_Sent": true,"Phone": \"A string\","Pictures_Uploaded": true,"STL_Uploaded": true,"Modified_Time": \"A string\","Retainer": true,"No_Welcome_Message": true,"PaymentId": \"A string\","Attended_Appointment": true,"Treatment": true,"No_Call": true,"Regular_Medicine": true
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "Owner": { \"foo\": \"bar\" },"Smile_Advisers": [ 1, \"a string\" ],"Lost_Reason": [ 1, \"a string\" ],"Contacted": [ 1, \"a string\" ],"Tag": [ 1, \"a string\" ],"Modified_By": { \"foo\": \"bar\" },"Contact_Tags": [ 1, \"a string\" ],"Prohibited_Treatment": true,"Address_Confirmed": true,"Reassign": true,"Chronic_Illness": true,"Currency": \"A string\","Stage": \"A string\","Country_Ops": \"A string\","Bleeding_Teeth": true,"Created_Time": \"A string\","CustomerId": \"A string\","Bridges": true,"Diagnostic_Sent": true,"Loose_Teeth": true,"Invoiced": true,"Final_Price": 1,"move_to_nurturing": true,"Send_Payment_Link": true,"Dentist_Last_Year": true,"CreateLink": true,"Patient_Name": \"A string\","Difficulty_Open_Mouth": true,"Group_Assigned": \"A string\","Mouth_Noise": true,"Send_Checkout": true,"Patient_Tier": \"A string\","Email": \"A string\","Last_Activity_Time": \"A string\","Deal_Name": \"A string\","Exchange_Rate": 1,"Need_Medical_Treatment": true,"move_to_lost": true,"Terms_Accepted": true,"Need_To_Check": true,"Requiere_return": true,"Invoice_Required": true,"Dental_Cleaning": true,"Planning_Approved": true,"STL_Exported": true,"Prepaid_Not_Found": true,"Payment_Status": \"A string\","Planning_Sent": true,"Phone": \"A string\","Pictures_Uploaded": true,"STL_Uploaded": true,"Modified_Time": \"A string\","Retainer": true,"No_Welcome_Message": true,"PaymentId": \"A string\","Attended_Appointment": true,"Treatment": true,"No_Call": true,"Regular_Medicine": true
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "Owner": { \"foo\": \"bar\" },"Smile_Advisers": [ 1, \"a string\" ],"Lost_Reason": [ 1, \"a string\" ],"Contacted": [ 1, \"a string\" ],"Tag": [ 1, \"a string\" ],"Modified_By": { \"foo\": \"bar\" },"Contact_Tags": [ 1, \"a string\" ],"Prohibited_Treatment": true,"Address_Confirmed": true,"Reassign": true,"Chronic_Illness": true,"Currency": \"A string\","Stage": \"A string\","Country_Ops": \"A string\","Bleeding_Teeth": true,"Created_Time": \"A string\","CustomerId": \"A string\","Bridges": true,"Diagnostic_Sent": true,"Loose_Teeth": true,"Invoiced": true,"Final_Price": 1,"move_to_nurturing": true,"Send_Payment_Link": true,"Dentist_Last_Year": true,"CreateLink": true,"Patient_Name": \"A string\","Difficulty_Open_Mouth": true,"Group_Assigned": \"A string\","Mouth_Noise": true,"Send_Checkout": true,"Patient_Tier": \"A string\","Email": \"A string\","Last_Activity_Time": \"A string\","Deal_Name": \"A string\","Exchange_Rate": 1,"Need_Medical_Treatment": true,"move_to_lost": true,"Terms_Accepted": true,"Need_To_Check": true,"Requiere_return": true,"Invoice_Required": true,"Dental_Cleaning": true,"Planning_Approved": true,"STL_Exported": true,"Prepaid_Not_Found": true,"Payment_Status": \"A string\","Planning_Sent": true,"Phone": \"A string\","Pictures_Uploaded": true,"STL_Uploaded": true,"Modified_Time": \"A string\","Retainer": true,"No_Welcome_Message": true,"PaymentId": \"A string\","Attended_Appointment": true,"Treatment": true,"No_Call": true,"Regular_Medicine": true
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Deal = Parse.Object.extend('Deal');
const query = new Parse.Query(Deal);
query.equalTo("Owner", { foo: 'bar' });
query.equalTo("Smile_Advisers", [1, 'a string']);
query.equalTo("Lost_Reason", [1, 'a string']);
query.equalTo("Contacted", [1, 'a string']);
query.equalTo("Tag", [1, 'a string']);
query.equalTo("Modified_By", { foo: 'bar' });
query.equalTo("Contact_Tags", [1, 'a string']);
query.equalTo("Prohibited_Treatment", true);
query.equalTo("Address_Confirmed", true);
query.equalTo("Reassign", true);
query.equalTo("Chronic_Illness", true);
query.equalTo("Currency", 'A string');
query.equalTo("Stage", 'A string');
query.equalTo("Country_Ops", 'A string');
query.equalTo("Bleeding_Teeth", true);
query.equalTo("Created_Time", 'A string');
query.equalTo("CustomerId", 'A string');
query.equalTo("Bridges", true);
query.equalTo("Diagnostic_Sent", true);
query.equalTo("Loose_Teeth", true);
query.equalTo("Invoiced", true);
query.equalTo("Final_Price", 1);
query.equalTo("move_to_nurturing", true);
query.equalTo("Send_Payment_Link", true);
query.equalTo("Dentist_Last_Year", true);
query.equalTo("CreateLink", true);
query.equalTo("Patient_Name", 'A string');
query.equalTo("Difficulty_Open_Mouth", true);
query.equalTo("Group_Assigned", 'A string');
query.equalTo("Mouth_Noise", true);
query.equalTo("Send_Checkout", true);
query.equalTo("Patient_Tier", 'A string');
query.equalTo("Email", 'A string');
query.equalTo("Last_Activity_Time", 'A string');
query.equalTo("Deal_Name", 'A string');
query.equalTo("Exchange_Rate", 1);
query.equalTo("Need_Medical_Treatment", true);
query.equalTo("move_to_lost", true);
query.equalTo("Terms_Accepted", true);
query.equalTo("Need_To_Check", true);
query.equalTo("Requiere_return", true);
query.equalTo("Invoice_Required", true);
query.equalTo("Dental_Cleaning", true);
query.equalTo("Planning_Approved", true);
query.equalTo("STL_Exported", true);
query.equalTo("Prepaid_Not_Found", true);
query.equalTo("Payment_Status", 'A string');
query.equalTo("Planning_Sent", true);
query.equalTo("Phone", 'A string');
query.equalTo("Pictures_Uploaded", true);
query.equalTo("STL_Uploaded", true);
query.equalTo("Modified_Time", 'A string');
query.equalTo("Retainer", true);
query.equalTo("No_Welcome_Message", true);
query.equalTo("PaymentId", 'A string');
query.equalTo("Attended_Appointment", true);
query.equalTo("Treatment", true);
query.equalTo("No_Call", true);
query.equalTo("Regular_Medicine", true);
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Deal found: ${JSON.stringify(results)}`);
  console.log('Deal found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Deal: ${JSON.stringify(error)}`);
  console.error('Error while fetching Deal', error);
});

Example Output:

{ foo: 'bar' } [1, 'a string'] [1, 'a string'] [1, 'a string'] [1, 'a string'] { foo: 'bar' } [1, 'a string'] true true true true 'A string' 'A string' 'A string' true 'A string' 'A string' true true true true 1 true true true true 'A string' true 'A string' true true 'A string' 'A string' 'A string' 'A string' 1 true true true true true true true true true true 'A string' true 'A string' true true 'A string' true true 'A string' true true true true 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Deal");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Deal")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Deal"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Deal");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
IDictionary Owner = result.Get<IDictionary>("Owner");
IList Smile_Advisers = result.Get<IList>("Smile_Advisers");
IList Lost_Reason = result.Get<IList>("Lost_Reason");
IList Contacted = result.Get<IList>("Contacted");
IList Tag = result.Get<IList>("Tag");
IDictionary Modified_By = result.Get<IDictionary>("Modified_By");
IList Contact_Tags = result.Get<IList>("Contact_Tags");
bool Prohibited_Treatment = result.Get<bool>("Prohibited_Treatment");
bool Address_Confirmed = result.Get<bool>("Address_Confirmed");
bool Reassign = result.Get<bool>("Reassign");
bool Chronic_Illness = result.Get<bool>("Chronic_Illness");
string Currency = result.Get<string>("Currency");
string Stage = result.Get<string>("Stage");
string Country_Ops = result.Get<string>("Country_Ops");
bool Bleeding_Teeth = result.Get<bool>("Bleeding_Teeth");
string Created_Time = result.Get<string>("Created_Time");
string CustomerId = result.Get<string>("CustomerId");
bool Bridges = result.Get<bool>("Bridges");
bool Diagnostic_Sent = result.Get<bool>("Diagnostic_Sent");
bool Loose_Teeth = result.Get<bool>("Loose_Teeth");
bool Invoiced = result.Get<bool>("Invoiced");
int Final_Price = result.Get<int>("Final_Price");
bool move_to_nurturing = result.Get<bool>("move_to_nurturing");
bool Send_Payment_Link = result.Get<bool>("Send_Payment_Link");
bool Dentist_Last_Year = result.Get<bool>("Dentist_Last_Year");
bool CreateLink = result.Get<bool>("CreateLink");
string Patient_Name = result.Get<string>("Patient_Name");
bool Difficulty_Open_Mouth = result.Get<bool>("Difficulty_Open_Mouth");
string Group_Assigned = result.Get<string>("Group_Assigned");
bool Mouth_Noise = result.Get<bool>("Mouth_Noise");
bool Send_Checkout = result.Get<bool>("Send_Checkout");
string Patient_Tier = result.Get<string>("Patient_Tier");
string Email = result.Get<string>("Email");
string Last_Activity_Time = result.Get<string>("Last_Activity_Time");
string Deal_Name = result.Get<string>("Deal_Name");
int Exchange_Rate = result.Get<int>("Exchange_Rate");
bool Need_Medical_Treatment = result.Get<bool>("Need_Medical_Treatment");
bool move_to_lost = result.Get<bool>("move_to_lost");
bool Terms_Accepted = result.Get<bool>("Terms_Accepted");
bool Need_To_Check = result.Get<bool>("Need_To_Check");
bool Requiere_return = result.Get<bool>("Requiere_return");
bool Invoice_Required = result.Get<bool>("Invoice_Required");
bool Dental_Cleaning = result.Get<bool>("Dental_Cleaning");
bool Planning_Approved = result.Get<bool>("Planning_Approved");
bool STL_Exported = result.Get<bool>("STL_Exported");
bool Prepaid_Not_Found = result.Get<bool>("Prepaid_Not_Found");
string Payment_Status = result.Get<string>("Payment_Status");
bool Planning_Sent = result.Get<bool>("Planning_Sent");
string Phone = result.Get<string>("Phone");
bool Pictures_Uploaded = result.Get<bool>("Pictures_Uploaded");
bool STL_Uploaded = result.Get<bool>("STL_Uploaded");
string Modified_Time = result.Get<string>("Modified_Time");
bool Retainer = result.Get<bool>("Retainer");
bool No_Welcome_Message = result.Get<bool>("No_Welcome_Message");
string PaymentId = result.Get<string>("PaymentId");
bool Attended_Appointment = result.Get<bool>("Attended_Appointment");
bool Treatment = result.Get<bool>("Treatment");
bool No_Call = result.Get<bool>("No_Call");
bool Regular_Medicine = result.Get<bool>("Regular_Medicine");
$query = new ParseQuery("Deal");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $Owner = $myCustomObject->get("Owner");
  $Smile_Advisers = $myCustomObject->get("Smile_Advisers");
  $Lost_Reason = $myCustomObject->get("Lost_Reason");
  $Contacted = $myCustomObject->get("Contacted");
  $Tag = $myCustomObject->get("Tag");
  $Modified_By = $myCustomObject->get("Modified_By");
  $Contact_Tags = $myCustomObject->get("Contact_Tags");
  $Prohibited_Treatment = $myCustomObject->get("Prohibited_Treatment");
  $Address_Confirmed = $myCustomObject->get("Address_Confirmed");
  $Reassign = $myCustomObject->get("Reassign");
  $Chronic_Illness = $myCustomObject->get("Chronic_Illness");
  $Currency = $myCustomObject->get("Currency");
  $Stage = $myCustomObject->get("Stage");
  $Country_Ops = $myCustomObject->get("Country_Ops");
  $Bleeding_Teeth = $myCustomObject->get("Bleeding_Teeth");
  $Created_Time = $myCustomObject->get("Created_Time");
  $CustomerId = $myCustomObject->get("CustomerId");
  $Bridges = $myCustomObject->get("Bridges");
  $Diagnostic_Sent = $myCustomObject->get("Diagnostic_Sent");
  $Loose_Teeth = $myCustomObject->get("Loose_Teeth");
  $Invoiced = $myCustomObject->get("Invoiced");
  $Final_Price = $myCustomObject->get("Final_Price");
  $move_to_nurturing = $myCustomObject->get("move_to_nurturing");
  $Send_Payment_Link = $myCustomObject->get("Send_Payment_Link");
  $Dentist_Last_Year = $myCustomObject->get("Dentist_Last_Year");
  $CreateLink = $myCustomObject->get("CreateLink");
  $Patient_Name = $myCustomObject->get("Patient_Name");
  $Difficulty_Open_Mouth = $myCustomObject->get("Difficulty_Open_Mouth");
  $Group_Assigned = $myCustomObject->get("Group_Assigned");
  $Mouth_Noise = $myCustomObject->get("Mouth_Noise");
  $Send_Checkout = $myCustomObject->get("Send_Checkout");
  $Patient_Tier = $myCustomObject->get("Patient_Tier");
  $Email = $myCustomObject->get("Email");
  $Last_Activity_Time = $myCustomObject->get("Last_Activity_Time");
  $Deal_Name = $myCustomObject->get("Deal_Name");
  $Exchange_Rate = $myCustomObject->get("Exchange_Rate");
  $Need_Medical_Treatment = $myCustomObject->get("Need_Medical_Treatment");
  $move_to_lost = $myCustomObject->get("move_to_lost");
  $Terms_Accepted = $myCustomObject->get("Terms_Accepted");
  $Need_To_Check = $myCustomObject->get("Need_To_Check");
  $Requiere_return = $myCustomObject->get("Requiere_return");
  $Invoice_Required = $myCustomObject->get("Invoice_Required");
  $Dental_Cleaning = $myCustomObject->get("Dental_Cleaning");
  $Planning_Approved = $myCustomObject->get("Planning_Approved");
  $STL_Exported = $myCustomObject->get("STL_Exported");
  $Prepaid_Not_Found = $myCustomObject->get("Prepaid_Not_Found");
  $Payment_Status = $myCustomObject->get("Payment_Status");
  $Planning_Sent = $myCustomObject->get("Planning_Sent");
  $Phone = $myCustomObject->get("Phone");
  $Pictures_Uploaded = $myCustomObject->get("Pictures_Uploaded");
  $STL_Uploaded = $myCustomObject->get("STL_Uploaded");
  $Modified_Time = $myCustomObject->get("Modified_Time");
  $Retainer = $myCustomObject->get("Retainer");
  $No_Welcome_Message = $myCustomObject->get("No_Welcome_Message");
  $PaymentId = $myCustomObject->get("PaymentId");
  $Attended_Appointment = $myCustomObject->get("Attended_Appointment");
  $Treatment = $myCustomObject->get("Treatment");
  $No_Call = $myCustomObject->get("No_Call");
  $Regular_Medicine = $myCustomObject->get("Regular_Medicine");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Deal

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"Owner\": { \"foo\": \"bar\" },\"Smile_Advisers\": [ 1, \"a string\" ],\"Lost_Reason\": [ 1, \"a string\" ],\"Contacted\": [ 1, \"a string\" ],\"Tag\": [ 1, \"a string\" ],\"Modified_By\": { \"foo\": \"bar\" },\"Contact_Tags\": [ 1, \"a string\" ],\"Prohibited_Treatment\": true,\"Address_Confirmed\": true,\"Reassign\": true,\"Chronic_Illness\": true,\"Currency\": \"A string\",\"Stage\": \"A string\",\"Country_Ops\": \"A string\",\"Bleeding_Teeth\": true,\"Created_Time\": \"A string\",\"CustomerId\": \"A string\",\"Bridges\": true,\"Diagnostic_Sent\": true,\"Loose_Teeth\": true,\"Invoiced\": true,\"Final_Price\": 1,\"move_to_nurturing\": true,\"Send_Payment_Link\": true,\"Dentist_Last_Year\": true,\"CreateLink\": true,\"Patient_Name\": \"A string\",\"Difficulty_Open_Mouth\": true,\"Group_Assigned\": \"A string\",\"Mouth_Noise\": true,\"Send_Checkout\": true,\"Patient_Tier\": \"A string\",\"Email\": \"A string\",\"Last_Activity_Time\": \"A string\",\"Deal_Name\": \"A string\",\"Exchange_Rate\": 1,\"Need_Medical_Treatment\": true,\"move_to_lost\": true,\"Terms_Accepted\": true,\"Need_To_Check\": true,\"Requiere_return\": true,\"Invoice_Required\": true,\"Dental_Cleaning\": true,\"Planning_Approved\": true,\"STL_Exported\": true,\"Prepaid_Not_Found\": true,\"Payment_Status\": \"A string\",\"Planning_Sent\": true,\"Phone\": \"A string\",\"Pictures_Uploaded\": true,\"STL_Uploaded\": true,\"Modified_Time\": \"A string\",\"Retainer\": true,\"No_Welcome_Message\": true,\"PaymentId\": \"A string\",\"Attended_Appointment\": true,\"Treatment\": true,\"No_Call\": true,\"Regular_Medicine\": true }" \
https://parseapi.back4app.com/classes/Deal/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "Owner": {"__op":"Delete"},"Smile_Advisers": {"__op":"Delete"},"Lost_Reason": {"__op":"Delete"},"Contacted": {"__op":"Delete"},"Tag": {"__op":"Delete"},"Modified_By": {"__op":"Delete"},"Contact_Tags": {"__op":"Delete"},"Prohibited_Treatment": {"__op":"Delete"},"Address_Confirmed": {"__op":"Delete"},"Reassign": {"__op":"Delete"},"Chronic_Illness": {"__op":"Delete"},"Currency": {"__op":"Delete"},"Stage": {"__op":"Delete"},"Country_Ops": {"__op":"Delete"},"Bleeding_Teeth": {"__op":"Delete"},"Created_Time": {"__op":"Delete"},"CustomerId": {"__op":"Delete"},"Bridges": {"__op":"Delete"},"Diagnostic_Sent": {"__op":"Delete"},"Loose_Teeth": {"__op":"Delete"},"Invoiced": {"__op":"Delete"},"Final_Price": {"__op":"Delete"},"move_to_nurturing": {"__op":"Delete"},"Send_Payment_Link": {"__op":"Delete"},"Dentist_Last_Year": {"__op":"Delete"},"CreateLink": {"__op":"Delete"},"Patient_Name": {"__op":"Delete"},"Difficulty_Open_Mouth": {"__op":"Delete"},"Group_Assigned": {"__op":"Delete"},"Mouth_Noise": {"__op":"Delete"},"Send_Checkout": {"__op":"Delete"},"Patient_Tier": {"__op":"Delete"},"Email": {"__op":"Delete"},"Last_Activity_Time": {"__op":"Delete"},"Deal_Name": {"__op":"Delete"},"Exchange_Rate": {"__op":"Delete"},"Need_Medical_Treatment": {"__op":"Delete"},"move_to_lost": {"__op":"Delete"},"Terms_Accepted": {"__op":"Delete"},"Need_To_Check": {"__op":"Delete"},"Requiere_return": {"__op":"Delete"},"Invoice_Required": {"__op":"Delete"},"Dental_Cleaning": {"__op":"Delete"},"Planning_Approved": {"__op":"Delete"},"STL_Exported": {"__op":"Delete"},"Prepaid_Not_Found": {"__op":"Delete"},"Payment_Status": {"__op":"Delete"},"Planning_Sent": {"__op":"Delete"},"Phone": {"__op":"Delete"},"Pictures_Uploaded": {"__op":"Delete"},"STL_Uploaded": {"__op":"Delete"},"Modified_Time": {"__op":"Delete"},"Retainer": {"__op":"Delete"},"No_Welcome_Message": {"__op":"Delete"},"PaymentId": {"__op":"Delete"},"Attended_Appointment": {"__op":"Delete"},"Treatment": {"__op":"Delete"},"No_Call": {"__op":"Delete"},"Regular_Medicine": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Deal

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Deal = Parse.Object.extend('Deal');
const query = new Parse.Query(Deal);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('Owner', { foo: 'bar' });
  object.set('Smile_Advisers', [1, 'a string']);
  object.set('Lost_Reason', [1, 'a string']);
  object.set('Contacted', [1, 'a string']);
  object.set('Tag', [1, 'a string']);
  object.set('Modified_By', { foo: 'bar' });
  object.set('Contact_Tags', [1, 'a string']);
  object.set('Prohibited_Treatment', true);
  object.set('Address_Confirmed', true);
  object.set('Reassign', true);
  object.set('Chronic_Illness', true);
  object.set('Currency', 'A string');
  object.set('Stage', 'A string');
  object.set('Country_Ops', 'A string');
  object.set('Bleeding_Teeth', true);
  object.set('Created_Time', 'A string');
  object.set('CustomerId', 'A string');
  object.set('Bridges', true);
  object.set('Diagnostic_Sent', true);
  object.set('Loose_Teeth', true);
  object.set('Invoiced', true);
  object.set('Final_Price', 1);
  object.set('move_to_nurturing', true);
  object.set('Send_Payment_Link', true);
  object.set('Dentist_Last_Year', true);
  object.set('CreateLink', true);
  object.set('Patient_Name', 'A string');
  object.set('Difficulty_Open_Mouth', true);
  object.set('Group_Assigned', 'A string');
  object.set('Mouth_Noise', true);
  object.set('Send_Checkout', true);
  object.set('Patient_Tier', 'A string');
  object.set('Email', 'A string');
  object.set('Last_Activity_Time', 'A string');
  object.set('Deal_Name', 'A string');
  object.set('Exchange_Rate', 1);
  object.set('Need_Medical_Treatment', true);
  object.set('move_to_lost', true);
  object.set('Terms_Accepted', true);
  object.set('Need_To_Check', true);
  object.set('Requiere_return', true);
  object.set('Invoice_Required', true);
  object.set('Dental_Cleaning', true);
  object.set('Planning_Approved', true);
  object.set('STL_Exported', true);
  object.set('Prepaid_Not_Found', true);
  object.set('Payment_Status', 'A string');
  object.set('Planning_Sent', true);
  object.set('Phone', 'A string');
  object.set('Pictures_Uploaded', true);
  object.set('STL_Uploaded', true);
  object.set('Modified_Time', 'A string');
  object.set('Retainer', true);
  object.set('No_Welcome_Message', true);
  object.set('PaymentId', 'A string');
  object.set('Attended_Appointment', true);
  object.set('Treatment', true);
  object.set('No_Call', true);
  object.set('Regular_Medicine', true);
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Deal: ${JSON.stringify(response)}`);
    console.log('Updated Deal', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Deal: ${JSON.stringify(error)}`);
    console.error('Error while updating Deal', error);
  });
});

Example Output:

ParseObjectSubclass { className: Deal, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Deal = Parse.Object.extend('Deal');
const query = new Parse.Query(Deal);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Deal: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Deal: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Deal', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Deal");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("Owner", new JSONObject());
        entity.put("Smile_Advisers", new JSONArray());
        entity.put("Lost_Reason", new JSONArray());
        entity.put("Contacted", new JSONArray());
        entity.put("Tag", new JSONArray());
        entity.put("Modified_By", new JSONObject());
        entity.put("Contact_Tags", new JSONArray());
        entity.put("Prohibited_Treatment", true);
        entity.put("Address_Confirmed", true);
        entity.put("Reassign", true);
        entity.put("Chronic_Illness", true);
        entity.put("Currency", "A string");
        entity.put("Stage", "A string");
        entity.put("Country_Ops", "A string");
        entity.put("Bleeding_Teeth", true);
        entity.put("Created_Time", "A string");
        entity.put("CustomerId", "A string");
        entity.put("Bridges", true);
        entity.put("Diagnostic_Sent", true);
        entity.put("Loose_Teeth", true);
        entity.put("Invoiced", true);
        entity.put("Final_Price", 1);
        entity.put("move_to_nurturing", true);
        entity.put("Send_Payment_Link", true);
        entity.put("Dentist_Last_Year", true);
        entity.put("CreateLink", true);
        entity.put("Patient_Name", "A string");
        entity.put("Difficulty_Open_Mouth", true);
        entity.put("Group_Assigned", "A string");
        entity.put("Mouth_Noise", true);
        entity.put("Send_Checkout", true);
        entity.put("Patient_Tier", "A string");
        entity.put("Email", "A string");
        entity.put("Last_Activity_Time", "A string");
        entity.put("Deal_Name", "A string");
        entity.put("Exchange_Rate", 1);
        entity.put("Need_Medical_Treatment", true);
        entity.put("move_to_lost", true);
        entity.put("Terms_Accepted", true);
        entity.put("Need_To_Check", true);
        entity.put("Requiere_return", true);
        entity.put("Invoice_Required", true);
        entity.put("Dental_Cleaning", true);
        entity.put("Planning_Approved", true);
        entity.put("STL_Exported", true);
        entity.put("Prepaid_Not_Found", true);
        entity.put("Payment_Status", "A string");
        entity.put("Planning_Sent", true);
        entity.put("Phone", "A string");
        entity.put("Pictures_Uploaded", true);
        entity.put("STL_Uploaded", true);
        entity.put("Modified_Time", "A string");
        entity.put("Retainer", true);
        entity.put("No_Welcome_Message", true);
        entity.put("PaymentId", "A string");
        entity.put("Attended_Appointment", true);
        entity.put("Treatment", true);
        entity.put("No_Call", true);
        entity.put("Regular_Medicine", true);

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Deal")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["Owner"] = [ "foo": "bar" ]
    parseObject["Smile_Advisers"] = [1, "a string"]
    parseObject["Lost_Reason"] = [1, "a string"]
    parseObject["Contacted"] = [1, "a string"]
    parseObject["Tag"] = [1, "a string"]
    parseObject["Modified_By"] = [ "foo": "bar" ]
    parseObject["Contact_Tags"] = [1, "a string"]
    parseObject["Prohibited_Treatment"] = true
    parseObject["Address_Confirmed"] = true
    parseObject["Reassign"] = true
    parseObject["Chronic_Illness"] = true
    parseObject["Currency"] = "A string"
    parseObject["Stage"] = "A string"
    parseObject["Country_Ops"] = "A string"
    parseObject["Bleeding_Teeth"] = true
    parseObject["Created_Time"] = "A string"
    parseObject["CustomerId"] = "A string"
    parseObject["Bridges"] = true
    parseObject["Diagnostic_Sent"] = true
    parseObject["Loose_Teeth"] = true
    parseObject["Invoiced"] = true
    parseObject["Final_Price"] = 1
    parseObject["move_to_nurturing"] = true
    parseObject["Send_Payment_Link"] = true
    parseObject["Dentist_Last_Year"] = true
    parseObject["CreateLink"] = true
    parseObject["Patient_Name"] = "A string"
    parseObject["Difficulty_Open_Mouth"] = true
    parseObject["Group_Assigned"] = "A string"
    parseObject["Mouth_Noise"] = true
    parseObject["Send_Checkout"] = true
    parseObject["Patient_Tier"] = "A string"
    parseObject["Email"] = "A string"
    parseObject["Last_Activity_Time"] = "A string"
    parseObject["Deal_Name"] = "A string"
    parseObject["Exchange_Rate"] = 1
    parseObject["Need_Medical_Treatment"] = true
    parseObject["move_to_lost"] = true
    parseObject["Terms_Accepted"] = true
    parseObject["Need_To_Check"] = true
    parseObject["Requiere_return"] = true
    parseObject["Invoice_Required"] = true
    parseObject["Dental_Cleaning"] = true
    parseObject["Planning_Approved"] = true
    parseObject["STL_Exported"] = true
    parseObject["Prepaid_Not_Found"] = true
    parseObject["Payment_Status"] = "A string"
    parseObject["Planning_Sent"] = true
    parseObject["Phone"] = "A string"
    parseObject["Pictures_Uploaded"] = true
    parseObject["STL_Uploaded"] = true
    parseObject["Modified_Time"] = "A string"
    parseObject["Retainer"] = true
    parseObject["No_Welcome_Message"] = true
    parseObject["PaymentId"] = "A string"
    parseObject["Attended_Appointment"] = true
    parseObject["Treatment"] = true
    parseObject["No_Call"] = true
    parseObject["Regular_Medicine"] = true

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Deal"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"Owner"] = @{ @"foo": @"bar" };
    parseObject[@"Smile_Advisers"] = @[@1, @"a string"];
    parseObject[@"Lost_Reason"] = @[@1, @"a string"];
    parseObject[@"Contacted"] = @[@1, @"a string"];
    parseObject[@"Tag"] = @[@1, @"a string"];
    parseObject[@"Modified_By"] = @{ @"foo": @"bar" };
    parseObject[@"Contact_Tags"] = @[@1, @"a string"];
    parseObject[@"Prohibited_Treatment"] = @YES;
    parseObject[@"Address_Confirmed"] = @YES;
    parseObject[@"Reassign"] = @YES;
    parseObject[@"Chronic_Illness"] = @YES;
    parseObject[@"Currency"] = @"A string";
    parseObject[@"Stage"] = @"A string";
    parseObject[@"Country_Ops"] = @"A string";
    parseObject[@"Bleeding_Teeth"] = @YES;
    parseObject[@"Created_Time"] = @"A string";
    parseObject[@"CustomerId"] = @"A string";
    parseObject[@"Bridges"] = @YES;
    parseObject[@"Diagnostic_Sent"] = @YES;
    parseObject[@"Loose_Teeth"] = @YES;
    parseObject[@"Invoiced"] = @YES;
    parseObject[@"Final_Price"] = @1;
    parseObject[@"move_to_nurturing"] = @YES;
    parseObject[@"Send_Payment_Link"] = @YES;
    parseObject[@"Dentist_Last_Year"] = @YES;
    parseObject[@"CreateLink"] = @YES;
    parseObject[@"Patient_Name"] = @"A string";
    parseObject[@"Difficulty_Open_Mouth"] = @YES;
    parseObject[@"Group_Assigned"] = @"A string";
    parseObject[@"Mouth_Noise"] = @YES;
    parseObject[@"Send_Checkout"] = @YES;
    parseObject[@"Patient_Tier"] = @"A string";
    parseObject[@"Email"] = @"A string";
    parseObject[@"Last_Activity_Time"] = @"A string";
    parseObject[@"Deal_Name"] = @"A string";
    parseObject[@"Exchange_Rate"] = @1;
    parseObject[@"Need_Medical_Treatment"] = @YES;
    parseObject[@"move_to_lost"] = @YES;
    parseObject[@"Terms_Accepted"] = @YES;
    parseObject[@"Need_To_Check"] = @YES;
    parseObject[@"Requiere_return"] = @YES;
    parseObject[@"Invoice_Required"] = @YES;
    parseObject[@"Dental_Cleaning"] = @YES;
    parseObject[@"Planning_Approved"] = @YES;
    parseObject[@"STL_Exported"] = @YES;
    parseObject[@"Prepaid_Not_Found"] = @YES;
    parseObject[@"Payment_Status"] = @"A string";
    parseObject[@"Planning_Sent"] = @YES;
    parseObject[@"Phone"] = @"A string";
    parseObject[@"Pictures_Uploaded"] = @YES;
    parseObject[@"STL_Uploaded"] = @YES;
    parseObject[@"Modified_Time"] = @"A string";
    parseObject[@"Retainer"] = @YES;
    parseObject[@"No_Welcome_Message"] = @YES;
    parseObject[@"PaymentId"] = @"A string";
    parseObject[@"Attended_Appointment"] = @YES;
    parseObject[@"Treatment"] = @YES;
    parseObject[@"No_Call"] = @YES;
    parseObject[@"Regular_Medicine"] = @YES;

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Deal");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["Owner"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["Smile_Advisers"] = new List<object>{1, "a string"};
myObject["Lost_Reason"] = new List<object>{1, "a string"};
myObject["Contacted"] = new List<object>{1, "a string"};
myObject["Tag"] = new List<object>{1, "a string"};
myObject["Modified_By"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["Contact_Tags"] = new List<object>{1, "a string"};
myObject["Prohibited_Treatment"] = true;
myObject["Address_Confirmed"] = true;
myObject["Reassign"] = true;
myObject["Chronic_Illness"] = true;
myObject["Currency"] = "A string";
myObject["Stage"] = "A string";
myObject["Country_Ops"] = "A string";
myObject["Bleeding_Teeth"] = true;
myObject["Created_Time"] = "A string";
myObject["CustomerId"] = "A string";
myObject["Bridges"] = true;
myObject["Diagnostic_Sent"] = true;
myObject["Loose_Teeth"] = true;
myObject["Invoiced"] = true;
myObject["Final_Price"] = 1;
myObject["move_to_nurturing"] = true;
myObject["Send_Payment_Link"] = true;
myObject["Dentist_Last_Year"] = true;
myObject["CreateLink"] = true;
myObject["Patient_Name"] = "A string";
myObject["Difficulty_Open_Mouth"] = true;
myObject["Group_Assigned"] = "A string";
myObject["Mouth_Noise"] = true;
myObject["Send_Checkout"] = true;
myObject["Patient_Tier"] = "A string";
myObject["Email"] = "A string";
myObject["Last_Activity_Time"] = "A string";
myObject["Deal_Name"] = "A string";
myObject["Exchange_Rate"] = 1;
myObject["Need_Medical_Treatment"] = true;
myObject["move_to_lost"] = true;
myObject["Terms_Accepted"] = true;
myObject["Need_To_Check"] = true;
myObject["Requiere_return"] = true;
myObject["Invoice_Required"] = true;
myObject["Dental_Cleaning"] = true;
myObject["Planning_Approved"] = true;
myObject["STL_Exported"] = true;
myObject["Prepaid_Not_Found"] = true;
myObject["Payment_Status"] = "A string";
myObject["Planning_Sent"] = true;
myObject["Phone"] = "A string";
myObject["Pictures_Uploaded"] = true;
myObject["STL_Uploaded"] = true;
myObject["Modified_Time"] = "A string";
myObject["Retainer"] = true;
myObject["No_Welcome_Message"] = true;
myObject["PaymentId"] = "A string";
myObject["Attended_Appointment"] = true;
myObject["Treatment"] = true;
myObject["No_Call"] = true;
myObject["Regular_Medicine"] = true;
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("Owner");
myObject.Remove("Smile_Advisers");
myObject.Remove("Lost_Reason");
myObject.Remove("Contacted");
myObject.Remove("Tag");
myObject.Remove("Modified_By");
myObject.Remove("Contact_Tags");
myObject.Remove("Prohibited_Treatment");
myObject.Remove("Address_Confirmed");
myObject.Remove("Reassign");
myObject.Remove("Chronic_Illness");
myObject.Remove("Currency");
myObject.Remove("Stage");
myObject.Remove("Country_Ops");
myObject.Remove("Bleeding_Teeth");
myObject.Remove("Created_Time");
myObject.Remove("CustomerId");
myObject.Remove("Bridges");
myObject.Remove("Diagnostic_Sent");
myObject.Remove("Loose_Teeth");
myObject.Remove("Invoiced");
myObject.Remove("Final_Price");
myObject.Remove("move_to_nurturing");
myObject.Remove("Send_Payment_Link");
myObject.Remove("Dentist_Last_Year");
myObject.Remove("CreateLink");
myObject.Remove("Patient_Name");
myObject.Remove("Difficulty_Open_Mouth");
myObject.Remove("Group_Assigned");
myObject.Remove("Mouth_Noise");
myObject.Remove("Send_Checkout");
myObject.Remove("Patient_Tier");
myObject.Remove("Email");
myObject.Remove("Last_Activity_Time");
myObject.Remove("Deal_Name");
myObject.Remove("Exchange_Rate");
myObject.Remove("Need_Medical_Treatment");
myObject.Remove("move_to_lost");
myObject.Remove("Terms_Accepted");
myObject.Remove("Need_To_Check");
myObject.Remove("Requiere_return");
myObject.Remove("Invoice_Required");
myObject.Remove("Dental_Cleaning");
myObject.Remove("Planning_Approved");
myObject.Remove("STL_Exported");
myObject.Remove("Prepaid_Not_Found");
myObject.Remove("Payment_Status");
myObject.Remove("Planning_Sent");
myObject.Remove("Phone");
myObject.Remove("Pictures_Uploaded");
myObject.Remove("STL_Uploaded");
myObject.Remove("Modified_Time");
myObject.Remove("Retainer");
myObject.Remove("No_Welcome_Message");
myObject.Remove("PaymentId");
myObject.Remove("Attended_Appointment");
myObject.Remove("Treatment");
myObject.Remove("No_Call");
myObject.Remove("Regular_Medicine");
await myObject.SaveAsync();
$query = new ParseQuery("Deal");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("Owner", ["foo" => "bar"]);
  $myCustomObject->set("Smile_Advisers", [1, "a string"]);
  $myCustomObject->set("Lost_Reason", [1, "a string"]);
  $myCustomObject->set("Contacted", [1, "a string"]);
  $myCustomObject->set("Tag", [1, "a string"]);
  $myCustomObject->set("Modified_By", ["foo" => "bar"]);
  $myCustomObject->set("Contact_Tags", [1, "a string"]);
  $myCustomObject->set("Prohibited_Treatment", true);
  $myCustomObject->set("Address_Confirmed", true);
  $myCustomObject->set("Reassign", true);
  $myCustomObject->set("Chronic_Illness", true);
  $myCustomObject->set("Currency", "A string");
  $myCustomObject->set("Stage", "A string");
  $myCustomObject->set("Country_Ops", "A string");
  $myCustomObject->set("Bleeding_Teeth", true);
  $myCustomObject->set("Created_Time", "A string");
  $myCustomObject->set("CustomerId", "A string");
  $myCustomObject->set("Bridges", true);
  $myCustomObject->set("Diagnostic_Sent", true);
  $myCustomObject->set("Loose_Teeth", true);
  $myCustomObject->set("Invoiced", true);
  $myCustomObject->set("Final_Price", 1);
  $myCustomObject->set("move_to_nurturing", true);
  $myCustomObject->set("Send_Payment_Link", true);
  $myCustomObject->set("Dentist_Last_Year", true);
  $myCustomObject->set("CreateLink", true);
  $myCustomObject->set("Patient_Name", "A string");
  $myCustomObject->set("Difficulty_Open_Mouth", true);
  $myCustomObject->set("Group_Assigned", "A string");
  $myCustomObject->set("Mouth_Noise", true);
  $myCustomObject->set("Send_Checkout", true);
  $myCustomObject->set("Patient_Tier", "A string");
  $myCustomObject->set("Email", "A string");
  $myCustomObject->set("Last_Activity_Time", "A string");
  $myCustomObject->set("Deal_Name", "A string");
  $myCustomObject->set("Exchange_Rate", 1);
  $myCustomObject->set("Need_Medical_Treatment", true);
  $myCustomObject->set("move_to_lost", true);
  $myCustomObject->set("Terms_Accepted", true);
  $myCustomObject->set("Need_To_Check", true);
  $myCustomObject->set("Requiere_return", true);
  $myCustomObject->set("Invoice_Required", true);
  $myCustomObject->set("Dental_Cleaning", true);
  $myCustomObject->set("Planning_Approved", true);
  $myCustomObject->set("STL_Exported", true);
  $myCustomObject->set("Prepaid_Not_Found", true);
  $myCustomObject->set("Payment_Status", "A string");
  $myCustomObject->set("Planning_Sent", true);
  $myCustomObject->set("Phone", "A string");
  $myCustomObject->set("Pictures_Uploaded", true);
  $myCustomObject->set("STL_Uploaded", true);
  $myCustomObject->set("Modified_Time", "A string");
  $myCustomObject->set("Retainer", true);
  $myCustomObject->set("No_Welcome_Message", true);
  $myCustomObject->set("PaymentId", "A string");
  $myCustomObject->set("Attended_Appointment", true);
  $myCustomObject->set("Treatment", true);
  $myCustomObject->set("No_Call", true);
  $myCustomObject->set("Regular_Medicine", true);

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Deal/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Deal/<OBJECT_ID>

Example Response:

{}

Code:

const Deal = Parse.Object.extend('Deal');
const query = new Parse.Query(Deal);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Deal: ${JSON.stringify(response)}`);
    console.log('Deleted Deal', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Deal: ${JSON.stringify(error)}`);
    console.error('Error while deleting Deal', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Deal', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Deal");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("Owner");
          entity.remove("Smile_Advisers");
          entity.remove("Lost_Reason");
          entity.remove("Contacted");
          entity.remove("Tag");
          entity.remove("Modified_By");
          entity.remove("Contact_Tags");
          entity.remove("Prohibited_Treatment");
          entity.remove("Address_Confirmed");
          entity.remove("Reassign");
          entity.remove("Chronic_Illness");
          entity.remove("Currency");
          entity.remove("Stage");
          entity.remove("Country_Ops");
          entity.remove("Bleeding_Teeth");
          entity.remove("Created_Time");
          entity.remove("CustomerId");
          entity.remove("Bridges");
          entity.remove("Diagnostic_Sent");
          entity.remove("Loose_Teeth");
          entity.remove("Invoiced");
          entity.remove("Final_Price");
          entity.remove("move_to_nurturing");
          entity.remove("Send_Payment_Link");
          entity.remove("Dentist_Last_Year");
          entity.remove("CreateLink");
          entity.remove("Patient_Name");
          entity.remove("Difficulty_Open_Mouth");
          entity.remove("Group_Assigned");
          entity.remove("Mouth_Noise");
          entity.remove("Send_Checkout");
          entity.remove("Patient_Tier");
          entity.remove("Email");
          entity.remove("Last_Activity_Time");
          entity.remove("Deal_Name");
          entity.remove("Exchange_Rate");
          entity.remove("Need_Medical_Treatment");
          entity.remove("move_to_lost");
          entity.remove("Terms_Accepted");
          entity.remove("Need_To_Check");
          entity.remove("Requiere_return");
          entity.remove("Invoice_Required");
          entity.remove("Dental_Cleaning");
          entity.remove("Planning_Approved");
          entity.remove("STL_Exported");
          entity.remove("Prepaid_Not_Found");
          entity.remove("Payment_Status");
          entity.remove("Planning_Sent");
          entity.remove("Phone");
          entity.remove("Pictures_Uploaded");
          entity.remove("STL_Uploaded");
          entity.remove("Modified_Time");
          entity.remove("Retainer");
          entity.remove("No_Welcome_Message");
          entity.remove("PaymentId");
          entity.remove("Attended_Appointment");
          entity.remove("Treatment");
          entity.remove("No_Call");
          entity.remove("Regular_Medicine");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Deal")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("Owner")
      parseObject.removeObjectForKey("Smile_Advisers")
      parseObject.removeObjectForKey("Lost_Reason")
      parseObject.removeObjectForKey("Contacted")
      parseObject.removeObjectForKey("Tag")
      parseObject.removeObjectForKey("Modified_By")
      parseObject.removeObjectForKey("Contact_Tags")
      parseObject.removeObjectForKey("Prohibited_Treatment")
      parseObject.removeObjectForKey("Address_Confirmed")
      parseObject.removeObjectForKey("Reassign")
      parseObject.removeObjectForKey("Chronic_Illness")
      parseObject.removeObjectForKey("Currency")
      parseObject.removeObjectForKey("Stage")
      parseObject.removeObjectForKey("Country_Ops")
      parseObject.removeObjectForKey("Bleeding_Teeth")
      parseObject.removeObjectForKey("Created_Time")
      parseObject.removeObjectForKey("CustomerId")
      parseObject.removeObjectForKey("Bridges")
      parseObject.removeObjectForKey("Diagnostic_Sent")
      parseObject.removeObjectForKey("Loose_Teeth")
      parseObject.removeObjectForKey("Invoiced")
      parseObject.removeObjectForKey("Final_Price")
      parseObject.removeObjectForKey("move_to_nurturing")
      parseObject.removeObjectForKey("Send_Payment_Link")
      parseObject.removeObjectForKey("Dentist_Last_Year")
      parseObject.removeObjectForKey("CreateLink")
      parseObject.removeObjectForKey("Patient_Name")
      parseObject.removeObjectForKey("Difficulty_Open_Mouth")
      parseObject.removeObjectForKey("Group_Assigned")
      parseObject.removeObjectForKey("Mouth_Noise")
      parseObject.removeObjectForKey("Send_Checkout")
      parseObject.removeObjectForKey("Patient_Tier")
      parseObject.removeObjectForKey("Email")
      parseObject.removeObjectForKey("Last_Activity_Time")
      parseObject.removeObjectForKey("Deal_Name")
      parseObject.removeObjectForKey("Exchange_Rate")
      parseObject.removeObjectForKey("Need_Medical_Treatment")
      parseObject.removeObjectForKey("move_to_lost")
      parseObject.removeObjectForKey("Terms_Accepted")
      parseObject.removeObjectForKey("Need_To_Check")
      parseObject.removeObjectForKey("Requiere_return")
      parseObject.removeObjectForKey("Invoice_Required")
      parseObject.removeObjectForKey("Dental_Cleaning")
      parseObject.removeObjectForKey("Planning_Approved")
      parseObject.removeObjectForKey("STL_Exported")
      parseObject.removeObjectForKey("Prepaid_Not_Found")
      parseObject.removeObjectForKey("Payment_Status")
      parseObject.removeObjectForKey("Planning_Sent")
      parseObject.removeObjectForKey("Phone")
      parseObject.removeObjectForKey("Pictures_Uploaded")
      parseObject.removeObjectForKey("STL_Uploaded")
      parseObject.removeObjectForKey("Modified_Time")
      parseObject.removeObjectForKey("Retainer")
      parseObject.removeObjectForKey("No_Welcome_Message")
      parseObject.removeObjectForKey("PaymentId")
      parseObject.removeObjectForKey("Attended_Appointment")
      parseObject.removeObjectForKey("Treatment")
      parseObject.removeObjectForKey("No_Call")
      parseObject.removeObjectForKey("Regular_Medicine")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Deal"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"Owner"];
  // [parseObject removeObjectForKey:@"Smile_Advisers"];
  // [parseObject removeObjectForKey:@"Lost_Reason"];
  // [parseObject removeObjectForKey:@"Contacted"];
  // [parseObject removeObjectForKey:@"Tag"];
  // [parseObject removeObjectForKey:@"Modified_By"];
  // [parseObject removeObjectForKey:@"Contact_Tags"];
  // [parseObject removeObjectForKey:@"Prohibited_Treatment"];
  // [parseObject removeObjectForKey:@"Address_Confirmed"];
  // [parseObject removeObjectForKey:@"Reassign"];
  // [parseObject removeObjectForKey:@"Chronic_Illness"];
  // [parseObject removeObjectForKey:@"Currency"];
  // [parseObject removeObjectForKey:@"Stage"];
  // [parseObject removeObjectForKey:@"Country_Ops"];
  // [parseObject removeObjectForKey:@"Bleeding_Teeth"];
  // [parseObject removeObjectForKey:@"Created_Time"];
  // [parseObject removeObjectForKey:@"CustomerId"];
  // [parseObject removeObjectForKey:@"Bridges"];
  // [parseObject removeObjectForKey:@"Diagnostic_Sent"];
  // [parseObject removeObjectForKey:@"Loose_Teeth"];
  // [parseObject removeObjectForKey:@"Invoiced"];
  // [parseObject removeObjectForKey:@"Final_Price"];
  // [parseObject removeObjectForKey:@"move_to_nurturing"];
  // [parseObject removeObjectForKey:@"Send_Payment_Link"];
  // [parseObject removeObjectForKey:@"Dentist_Last_Year"];
  // [parseObject removeObjectForKey:@"CreateLink"];
  // [parseObject removeObjectForKey:@"Patient_Name"];
  // [parseObject removeObjectForKey:@"Difficulty_Open_Mouth"];
  // [parseObject removeObjectForKey:@"Group_Assigned"];
  // [parseObject removeObjectForKey:@"Mouth_Noise"];
  // [parseObject removeObjectForKey:@"Send_Checkout"];
  // [parseObject removeObjectForKey:@"Patient_Tier"];
  // [parseObject removeObjectForKey:@"Email"];
  // [parseObject removeObjectForKey:@"Last_Activity_Time"];
  // [parseObject removeObjectForKey:@"Deal_Name"];
  // [parseObject removeObjectForKey:@"Exchange_Rate"];
  // [parseObject removeObjectForKey:@"Need_Medical_Treatment"];
  // [parseObject removeObjectForKey:@"move_to_lost"];
  // [parseObject removeObjectForKey:@"Terms_Accepted"];
  // [parseObject removeObjectForKey:@"Need_To_Check"];
  // [parseObject removeObjectForKey:@"Requiere_return"];
  // [parseObject removeObjectForKey:@"Invoice_Required"];
  // [parseObject removeObjectForKey:@"Dental_Cleaning"];
  // [parseObject removeObjectForKey:@"Planning_Approved"];
  // [parseObject removeObjectForKey:@"STL_Exported"];
  // [parseObject removeObjectForKey:@"Prepaid_Not_Found"];
  // [parseObject removeObjectForKey:@"Payment_Status"];
  // [parseObject removeObjectForKey:@"Planning_Sent"];
  // [parseObject removeObjectForKey:@"Phone"];
  // [parseObject removeObjectForKey:@"Pictures_Uploaded"];
  // [parseObject removeObjectForKey:@"STL_Uploaded"];
  // [parseObject removeObjectForKey:@"Modified_Time"];
  // [parseObject removeObjectForKey:@"Retainer"];
  // [parseObject removeObjectForKey:@"No_Welcome_Message"];
  // [parseObject removeObjectForKey:@"PaymentId"];
  // [parseObject removeObjectForKey:@"Attended_Appointment"];
  // [parseObject removeObjectForKey:@"Treatment"];
  // [parseObject removeObjectForKey:@"No_Call"];
  // [parseObject removeObjectForKey:@"Regular_Medicine"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Deal");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Deal");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("Owner");
  $myCustomObject->delete("Smile_Advisers");
  $myCustomObject->delete("Lost_Reason");
  $myCustomObject->delete("Contacted");
  $myCustomObject->delete("Tag");
  $myCustomObject->delete("Modified_By");
  $myCustomObject->delete("Contact_Tags");
  $myCustomObject->delete("Prohibited_Treatment");
  $myCustomObject->delete("Address_Confirmed");
  $myCustomObject->delete("Reassign");
  $myCustomObject->delete("Chronic_Illness");
  $myCustomObject->delete("Currency");
  $myCustomObject->delete("Stage");
  $myCustomObject->delete("Country_Ops");
  $myCustomObject->delete("Bleeding_Teeth");
  $myCustomObject->delete("Created_Time");
  $myCustomObject->delete("CustomerId");
  $myCustomObject->delete("Bridges");
  $myCustomObject->delete("Diagnostic_Sent");
  $myCustomObject->delete("Loose_Teeth");
  $myCustomObject->delete("Invoiced");
  $myCustomObject->delete("Final_Price");
  $myCustomObject->delete("move_to_nurturing");
  $myCustomObject->delete("Send_Payment_Link");
  $myCustomObject->delete("Dentist_Last_Year");
  $myCustomObject->delete("CreateLink");
  $myCustomObject->delete("Patient_Name");
  $myCustomObject->delete("Difficulty_Open_Mouth");
  $myCustomObject->delete("Group_Assigned");
  $myCustomObject->delete("Mouth_Noise");
  $myCustomObject->delete("Send_Checkout");
  $myCustomObject->delete("Patient_Tier");
  $myCustomObject->delete("Email");
  $myCustomObject->delete("Last_Activity_Time");
  $myCustomObject->delete("Deal_Name");
  $myCustomObject->delete("Exchange_Rate");
  $myCustomObject->delete("Need_Medical_Treatment");
  $myCustomObject->delete("move_to_lost");
  $myCustomObject->delete("Terms_Accepted");
  $myCustomObject->delete("Need_To_Check");
  $myCustomObject->delete("Requiere_return");
  $myCustomObject->delete("Invoice_Required");
  $myCustomObject->delete("Dental_Cleaning");
  $myCustomObject->delete("Planning_Approved");
  $myCustomObject->delete("STL_Exported");
  $myCustomObject->delete("Prepaid_Not_Found");
  $myCustomObject->delete("Payment_Status");
  $myCustomObject->delete("Planning_Sent");
  $myCustomObject->delete("Phone");
  $myCustomObject->delete("Pictures_Uploaded");
  $myCustomObject->delete("STL_Uploaded");
  $myCustomObject->delete("Modified_Time");
  $myCustomObject->delete("Retainer");
  $myCustomObject->delete("No_Welcome_Message");
  $myCustomObject->delete("PaymentId");
  $myCustomObject->delete("Attended_Appointment");
  $myCustomObject->delete("Treatment");
  $myCustomObject->delete("No_Call");
  $myCustomObject->delete("Regular_Medicine");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Deal/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Number_plate_log Class

Example JSON:

{
  "number_plate": "A string",
  "camera": "A string"
}

Number_plate_log is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Number_plate_log

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
number_plate String "A string"
camera String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"number_plate\":\"A string\",\"camera\":\"A string\" }" \
https://parseapi.back4app.com/classes/Number_plate_log

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Number_plate_log = Parse.Object.extend('Number_plate_log');
const myNewObject = new Number_plate_log();

myNewObject.set('number_plate', 'A string');
myNewObject.set('camera', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Number_plate_log created: ${JSON.stringify(result)}`);
    console.log('Number_plate_log created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Number_plate_log: ${JSON.stringify(error)}`);
    console.error('Error while creating Number_plate_log: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Number_plate_log");

  entity.put("number_plate", "A string");
  entity.put("camera", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Number_plate_log")

parseObject["number_plate"] = "A string"
parseObject["camera"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Number_plate_log"];

parseObject[@"number_plate"] = @"A string";
parseObject[@"camera"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Number_plate_log");
myObject["number_plate"] = "A string";
myObject["camera"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Number_plate_log");

$myCustomObject->set("number_plate", "A string");
$myCustomObject->set("camera", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Number_plate_log',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Number_plate_log class, you'll need to send a POST request to the Number_plate_log class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Number_plate_log

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Number_plate_log/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"number_plate\":\"A string\",\"camera\":\"A string\" }" \
https://parseapi.back4app.com/classes/Number_plate_log

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "number_plate": \"A string\","camera": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "number_plate": \"A string\","camera": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "number_plate": \"A string\","camera": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Number_plate_log = Parse.Object.extend('Number_plate_log');
const query = new Parse.Query(Number_plate_log);
query.equalTo("number_plate", 'A string');
query.equalTo("camera", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Number_plate_log found: ${JSON.stringify(results)}`);
  console.log('Number_plate_log found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Number_plate_log: ${JSON.stringify(error)}`);
  console.error('Error while fetching Number_plate_log', error);
});

Example Output:

'A string' 'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Number_plate_log");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Number_plate_log")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Number_plate_log"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Number_plate_log");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string number_plate = result.Get<string>("number_plate");
string camera = result.Get<string>("camera");
$query = new ParseQuery("Number_plate_log");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $number_plate = $myCustomObject->get("number_plate");
  $camera = $myCustomObject->get("camera");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Number_plate_log

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"number_plate\": \"A string\",\"camera\": \"A string\" }" \
https://parseapi.back4app.com/classes/Number_plate_log/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "number_plate": {"__op":"Delete"},"camera": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Number_plate_log

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Number_plate_log = Parse.Object.extend('Number_plate_log');
const query = new Parse.Query(Number_plate_log);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('number_plate', 'A string');
  object.set('camera', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Number_plate_log: ${JSON.stringify(response)}`);
    console.log('Updated Number_plate_log', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Number_plate_log: ${JSON.stringify(error)}`);
    console.error('Error while updating Number_plate_log', error);
  });
});

Example Output:

ParseObjectSubclass { className: Number_plate_log, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Number_plate_log = Parse.Object.extend('Number_plate_log');
const query = new Parse.Query(Number_plate_log);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Number_plate_log: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Number_plate_log: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Number_plate_log', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Number_plate_log");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("number_plate", "A string");
        entity.put("camera", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Number_plate_log")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["number_plate"] = "A string"
    parseObject["camera"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Number_plate_log"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"number_plate"] = @"A string";
    parseObject[@"camera"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Number_plate_log");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["number_plate"] = "A string";
myObject["camera"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("number_plate");
myObject.Remove("camera");
await myObject.SaveAsync();
$query = new ParseQuery("Number_plate_log");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("number_plate", "A string");
  $myCustomObject->set("camera", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Number_plate_log/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Number_plate_log/<OBJECT_ID>

Example Response:

{}

Code:

const Number_plate_log = Parse.Object.extend('Number_plate_log');
const query = new Parse.Query(Number_plate_log);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Number_plate_log: ${JSON.stringify(response)}`);
    console.log('Deleted Number_plate_log', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Number_plate_log: ${JSON.stringify(error)}`);
    console.error('Error while deleting Number_plate_log', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Number_plate_log', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Number_plate_log");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("number_plate");
          entity.remove("camera");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Number_plate_log")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("number_plate")
      parseObject.removeObjectForKey("camera")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Number_plate_log"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"number_plate"];
  // [parseObject removeObjectForKey:@"camera"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Number_plate_log");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Number_plate_log");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("number_plate");
  $myCustomObject->delete("camera");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Number_plate_log/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Question Class

Example JSON:

{
  "questionStr": "A string",
  "selections": "A string",
  "correctAnswer": "A string"
}

Question is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Question

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
questionStr String "A string"
selections String "A string"
correctAnswer String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"questionStr\":\"A string\",\"selections\":\"A string\",\"correctAnswer\":\"A string\" }" \
https://parseapi.back4app.com/classes/Question

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Question = Parse.Object.extend('Question');
const myNewObject = new Question();

myNewObject.set('questionStr', 'A string');
myNewObject.set('selections', 'A string');
myNewObject.set('correctAnswer', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Question created: ${JSON.stringify(result)}`);
    console.log('Question created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Question: ${JSON.stringify(error)}`);
    console.error('Error while creating Question: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Question");

  entity.put("questionStr", "A string");
  entity.put("selections", "A string");
  entity.put("correctAnswer", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Question")

parseObject["questionStr"] = "A string"
parseObject["selections"] = "A string"
parseObject["correctAnswer"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Question"];

parseObject[@"questionStr"] = @"A string";
parseObject[@"selections"] = @"A string";
parseObject[@"correctAnswer"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Question");
myObject["questionStr"] = "A string";
myObject["selections"] = "A string";
myObject["correctAnswer"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Question");

$myCustomObject->set("questionStr", "A string");
$myCustomObject->set("selections", "A string");
$myCustomObject->set("correctAnswer", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Question',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Question class, you'll need to send a POST request to the Question class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Question

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Question/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"questionStr\":\"A string\",\"selections\":\"A string\",\"correctAnswer\":\"A string\" }" \
https://parseapi.back4app.com/classes/Question

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "questionStr": \"A string\","selections": \"A string\","correctAnswer": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "questionStr": \"A string\","selections": \"A string\","correctAnswer": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "questionStr": \"A string\","selections": \"A string\","correctAnswer": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Question = Parse.Object.extend('Question');
const query = new Parse.Query(Question);
query.equalTo("questionStr", 'A string');
query.equalTo("selections", 'A string');
query.equalTo("correctAnswer", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Question found: ${JSON.stringify(results)}`);
  console.log('Question found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Question: ${JSON.stringify(error)}`);
  console.error('Error while fetching Question', error);
});

Example Output:

'A string' 'A string' 'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Question");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Question")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Question"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Question");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string questionStr = result.Get<string>("questionStr");
string selections = result.Get<string>("selections");
string correctAnswer = result.Get<string>("correctAnswer");
$query = new ParseQuery("Question");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $questionStr = $myCustomObject->get("questionStr");
  $selections = $myCustomObject->get("selections");
  $correctAnswer = $myCustomObject->get("correctAnswer");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Question

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"questionStr\": \"A string\",\"selections\": \"A string\",\"correctAnswer\": \"A string\" }" \
https://parseapi.back4app.com/classes/Question/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "questionStr": {"__op":"Delete"},"selections": {"__op":"Delete"},"correctAnswer": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Question

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Question = Parse.Object.extend('Question');
const query = new Parse.Query(Question);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('questionStr', 'A string');
  object.set('selections', 'A string');
  object.set('correctAnswer', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Question: ${JSON.stringify(response)}`);
    console.log('Updated Question', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Question: ${JSON.stringify(error)}`);
    console.error('Error while updating Question', error);
  });
});

Example Output:

ParseObjectSubclass { className: Question, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Question = Parse.Object.extend('Question');
const query = new Parse.Query(Question);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Question: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Question: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Question', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Question");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("questionStr", "A string");
        entity.put("selections", "A string");
        entity.put("correctAnswer", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Question")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["questionStr"] = "A string"
    parseObject["selections"] = "A string"
    parseObject["correctAnswer"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Question"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"questionStr"] = @"A string";
    parseObject[@"selections"] = @"A string";
    parseObject[@"correctAnswer"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Question");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["questionStr"] = "A string";
myObject["selections"] = "A string";
myObject["correctAnswer"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("questionStr");
myObject.Remove("selections");
myObject.Remove("correctAnswer");
await myObject.SaveAsync();
$query = new ParseQuery("Question");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("questionStr", "A string");
  $myCustomObject->set("selections", "A string");
  $myCustomObject->set("correctAnswer", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Question/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Question/<OBJECT_ID>

Example Response:

{}

Code:

const Question = Parse.Object.extend('Question');
const query = new Parse.Query(Question);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Question: ${JSON.stringify(response)}`);
    console.log('Deleted Question', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Question: ${JSON.stringify(error)}`);
    console.error('Error while deleting Question', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Question', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Question");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("questionStr");
          entity.remove("selections");
          entity.remove("correctAnswer");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Question")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("questionStr")
      parseObject.removeObjectForKey("selections")
      parseObject.removeObjectForKey("correctAnswer")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Question"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"questionStr"];
  // [parseObject removeObjectForKey:@"selections"];
  // [parseObject removeObjectForKey:@"correctAnswer"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Question");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Question");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("questionStr");
  $myCustomObject->delete("selections");
  $myCustomObject->delete("correctAnswer");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Question/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

users Class

Example JSON:

{
  "name": "A string"
}

users is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/users

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/users

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const users = Parse.Object.extend('users');
const myNewObject = new users();

myNewObject.set('name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`users created: ${JSON.stringify(result)}`);
    console.log('users created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating users: ${JSON.stringify(error)}`);
    console.error('Error while creating users: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("users");

  entity.put("name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"users")

parseObject["name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"users"];

parseObject[@"name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("users");
myObject["name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("users");

$myCustomObject->set("name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'users',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the users class, you'll need to send a POST request to the users class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/users

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/users/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"name\":\"A string\" }" \
https://parseapi.back4app.com/classes/users

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const users = Parse.Object.extend('users');
const query = new Parse.Query(users);
query.equalTo("name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`users found: ${JSON.stringify(results)}`);
  console.log('users found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching users: ${JSON.stringify(error)}`);
  console.error('Error while fetching users', error);
});

Example Output:

'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("users");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"users")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"users"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("users");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string name = result.Get<string>("name");
$query = new ParseQuery("users");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $name = $myCustomObject->get("name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/users

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"name\": \"A string\" }" \
https://parseapi.back4app.com/classes/users/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/users

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const users = Parse.Object.extend('users');
const query = new Parse.Query(users);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated users: ${JSON.stringify(response)}`);
    console.log('Updated users', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating users: ${JSON.stringify(error)}`);
    console.error('Error while updating users', error);
  });
});

Example Output:

ParseObjectSubclass { className: users, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const users = Parse.Object.extend('users');
const query = new Parse.Query(users);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated users: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating users: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'users', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("users");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"users")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"users"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("users");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("name");
await myObject.SaveAsync();
$query = new ParseQuery("users");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/users/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/users/<OBJECT_ID>

Example Response:

{}

Code:

const users = Parse.Object.extend('users');
const query = new Parse.Query(users);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted users: ${JSON.stringify(response)}`);
    console.log('Deleted users', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting users: ${JSON.stringify(error)}`);
    console.error('Error while deleting users', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'users', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("users");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"users")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"users"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("users");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("users");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/users/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Auction Class

Example JSON:

{
  "startPrice": 1,
  "category": "A string",
  "gallery": [1, "a string"],
  "status": 1,
  "actualPrice": 1,
  "regionCode": "A string",
  "countryCode": "A string",
  "endDate": "2018-11-12T13:13:45.958Z",
  "title": "A string",
  "desc": "A string",
  "buyPrice": 1,
  "currency": "A string",
  "expireDays": 1,
  "user": { "__type": "Pointer", "className": "User", "objectId": "<THE_REFERENCED_OBJECT_ID>" }
}

Auction is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Auction

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
startPrice Number 1
category String "A string"
gallery Array [1, "a string"]
status Number 1
actualPrice Number 1
regionCode String "A string"
countryCode String "A string"
endDate Date "2018-11-12T13:13:45.958Z"
title String "A string"
desc String "A string"
buyPrice Number 1
currency String "A string"
expireDays Number 1
user Pointer { "__type": "Pointer", "className": "User", "objectId": "<THE_REFERENCED_OBJECT_ID>" }

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"startPrice\":1,\"category\":\"A string\",\"gallery\":[ 1, \"a string\" ],\"status\":1,\"actualPrice\":1,\"regionCode\":\"A string\",\"countryCode\":\"A string\",\"endDate\":{ \"__type\": \"Date\", \"iso\": \"2018-11-06T18:02:52.249Z\" },\"title\":\"A string\",\"desc\":\"A string\",\"buyPrice\":1,\"currency\":\"A string\",\"expireDays\":1,\"user\":{ \"__type\": \"Pointer\", \"className\": \"User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Auction

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Auction = Parse.Object.extend('Auction');
const myNewObject = new Auction();

myNewObject.set('startPrice', 1);
myNewObject.set('category', 'A string');
myNewObject.set('gallery', [1, 'a string']);
myNewObject.set('status', 1);
myNewObject.set('actualPrice', 1);
myNewObject.set('regionCode', 'A string');
myNewObject.set('countryCode', 'A string');
myNewObject.set('endDate', new Date());
myNewObject.set('title', 'A string');
myNewObject.set('desc', 'A string');
myNewObject.set('buyPrice', 1);
myNewObject.set('currency', 'A string');
myNewObject.set('expireDays', 1);
myNewObject.set('user', new Parse.Object("User"));

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Auction created: ${JSON.stringify(result)}`);
    console.log('Auction created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Auction: ${JSON.stringify(error)}`);
    console.error('Error while creating Auction: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Auction");

  entity.put("startPrice", 1);
  entity.put("category", "A string");
  entity.put("gallery", new JSONArray());
  entity.put("status", 1);
  entity.put("actualPrice", 1);
  entity.put("regionCode", "A string");
  entity.put("countryCode", "A string");
  entity.put("endDate", new Date());
  entity.put("title", "A string");
  entity.put("desc", "A string");
  entity.put("buyPrice", 1);
  entity.put("currency", "A string");
  entity.put("expireDays", 1);
  entity.put("user", new ParseObject("User"));

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Auction")

parseObject["startPrice"] = 1
parseObject["category"] = "A string"
parseObject["gallery"] = [1, "a string"]
parseObject["status"] = 1
parseObject["actualPrice"] = 1
parseObject["regionCode"] = "A string"
parseObject["countryCode"] = "A string"
parseObject["endDate"] = NSDate()
parseObject["title"] = "A string"
parseObject["desc"] = "A string"
parseObject["buyPrice"] = 1
parseObject["currency"] = "A string"
parseObject["expireDays"] = 1
parseObject["user"] = PFObject(className:"User")

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Auction"];

parseObject[@"startPrice"] = @1;
parseObject[@"category"] = @"A string";
parseObject[@"gallery"] = @[@1, @"a string"];
parseObject[@"status"] = @1;
parseObject[@"actualPrice"] = @1;
parseObject[@"regionCode"] = @"A string";
parseObject[@"countryCode"] = @"A string";
parseObject[@"endDate"] = [NSDate date];
parseObject[@"title"] = @"A string";
parseObject[@"desc"] = @"A string";
parseObject[@"buyPrice"] = @1;
parseObject[@"currency"] = @"A string";
parseObject[@"expireDays"] = @1;
parseObject[@"user"] = [PFObject objectWithClassName:@"User"];

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Auction");
myObject["startPrice"] = 1;
myObject["category"] = "A string";
myObject["gallery"] = new List<object>{1, "a string"};
myObject["status"] = 1;
myObject["actualPrice"] = 1;
myObject["regionCode"] = "A string";
myObject["countryCode"] = "A string";
myObject["endDate"] = DateTime.Now;
myObject["title"] = "A string";
myObject["desc"] = "A string";
myObject["buyPrice"] = 1;
myObject["currency"] = "A string";
myObject["expireDays"] = 1;
myObject["user"] = new ParseObject("User");
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Auction");

$myCustomObject->set("startPrice", 1);
$myCustomObject->set("category", "A string");
$myCustomObject->set("gallery", [1, "a string"]);
$myCustomObject->set("status", 1);
$myCustomObject->set("actualPrice", 1);
$myCustomObject->set("regionCode", "A string");
$myCustomObject->set("countryCode", "A string");
$myCustomObject->set("endDate", new DateTime());
$myCustomObject->set("title", "A string");
$myCustomObject->set("desc", "A string");
$myCustomObject->set("buyPrice", 1);
$myCustomObject->set("currency", "A string");
$myCustomObject->set("expireDays", 1);
$myCustomObject->set("user", new ParseObject("User"));

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Auction',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Auction class, you'll need to send a POST request to the Auction class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Auction

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Auction/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"startPrice\":1,\"category\":\"A string\",\"gallery\":[ 1, \"a string\" ],\"status\":1,\"actualPrice\":1,\"regionCode\":\"A string\",\"countryCode\":\"A string\",\"endDate\":{ \"__type\": \"Date\", \"iso\": \"2018-11-06T18:02:52.249Z\" },\"title\":\"A string\",\"desc\":\"A string\",\"buyPrice\":1,\"currency\":\"A string\",\"expireDays\":1,\"user\":{ \"__type\": \"Pointer\", \"className\": \"User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Auction

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "startPrice": 1,"category": \"A string\","gallery": [ 1, \"a string\" ],"status": 1,"actualPrice": 1,"regionCode": \"A string\","countryCode": \"A string\","endDate": { \"__type\": \"Date\", \"iso\": \"2018-11-06T18:02:52.249Z\" },"title": \"A string\","desc": \"A string\","buyPrice": 1,"currency": \"A string\","expireDays": 1,"user": { \"__type\": \"Pointer\", \"className\": \"User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "startPrice": 1,"category": \"A string\","gallery": [ 1, \"a string\" ],"status": 1,"actualPrice": 1,"regionCode": \"A string\","countryCode": \"A string\","endDate": { \"__type\": \"Date\", \"iso\": \"2018-11-06T18:02:52.249Z\" },"title": \"A string\","desc": \"A string\","buyPrice": 1,"currency": \"A string\","expireDays": 1,"user": { \"__type\": \"Pointer\", \"className\": \"User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "startPrice": 1,"category": \"A string\","gallery": [ 1, \"a string\" ],"status": 1,"actualPrice": 1,"regionCode": \"A string\","countryCode": \"A string\","endDate": { \"__type\": \"Date\", \"iso\": \"2018-11-06T18:02:52.249Z\" },"title": \"A string\","desc": \"A string\","buyPrice": 1,"currency": \"A string\","expireDays": 1,"user": { \"__type\": \"Pointer\", \"className\": \"User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Auction = Parse.Object.extend('Auction');
const query = new Parse.Query(Auction);
query.equalTo("startPrice", 1);
query.equalTo("category", 'A string');
query.equalTo("gallery", [1, 'a string']);
query.equalTo("status", 1);
query.equalTo("actualPrice", 1);
query.equalTo("regionCode", 'A string');
query.equalTo("countryCode", 'A string');
query.equalTo("endDate", new Date());
query.equalTo("title", 'A string');
query.equalTo("desc", 'A string');
query.equalTo("buyPrice", 1);
query.equalTo("currency", 'A string');
query.equalTo("expireDays", 1);
query.equalTo("user", new Parse.Object("User"));
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Auction found: ${JSON.stringify(results)}`);
  console.log('Auction found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Auction: ${JSON.stringify(error)}`);
  console.error('Error while fetching Auction', error);
});

Example Output:

1 'A string' [1, 'a string'] 1 1 'A string' 'A string' new Date() 'A string' 'A string' 1 'A string' 1 new Parse.Object("User") 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Auction");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Auction")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Auction"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Auction");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
int startPrice = result.Get<int>("startPrice");
string category = result.Get<string>("category");
IList gallery = result.Get<IList>("gallery");
int status = result.Get<int>("status");
int actualPrice = result.Get<int>("actualPrice");
string regionCode = result.Get<string>("regionCode");
string countryCode = result.Get<string>("countryCode");
DateTime endDate = result.Get<DateTime>("endDate");
string title = result.Get<string>("title");
string desc = result.Get<string>("desc");
int buyPrice = result.Get<int>("buyPrice");
string currency = result.Get<string>("currency");
int expireDays = result.Get<int>("expireDays");
ParseObject user = result.Get<ParseObject>("user");
$query = new ParseQuery("Auction");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $startPrice = $myCustomObject->get("startPrice");
  $category = $myCustomObject->get("category");
  $gallery = $myCustomObject->get("gallery");
  $status = $myCustomObject->get("status");
  $actualPrice = $myCustomObject->get("actualPrice");
  $regionCode = $myCustomObject->get("regionCode");
  $countryCode = $myCustomObject->get("countryCode");
  $endDate = $myCustomObject->get("endDate");
  $title = $myCustomObject->get("title");
  $desc = $myCustomObject->get("desc");
  $buyPrice = $myCustomObject->get("buyPrice");
  $currency = $myCustomObject->get("currency");
  $expireDays = $myCustomObject->get("expireDays");
  $user = $myCustomObject->get("user");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Auction

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"startPrice\": 1,\"category\": \"A string\",\"gallery\": [ 1, \"a string\" ],\"status\": 1,\"actualPrice\": 1,\"regionCode\": \"A string\",\"countryCode\": \"A string\",\"endDate\": { \"__type\": \"Date\", \"iso\": \"2018-11-06T18:02:52.249Z\" },\"title\": \"A string\",\"desc\": \"A string\",\"buyPrice\": 1,\"currency\": \"A string\",\"expireDays\": 1,\"user\": { \"__type\": \"Pointer\", \"className\": \"User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Auction/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "startPrice": {"__op":"Delete"},"category": {"__op":"Delete"},"gallery": {"__op":"Delete"},"status": {"__op":"Delete"},"actualPrice": {"__op":"Delete"},"regionCode": {"__op":"Delete"},"countryCode": {"__op":"Delete"},"endDate": {"__op":"Delete"},"title": {"__op":"Delete"},"desc": {"__op":"Delete"},"buyPrice": {"__op":"Delete"},"currency": {"__op":"Delete"},"expireDays": {"__op":"Delete"},"user": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Auction

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Auction = Parse.Object.extend('Auction');
const query = new Parse.Query(Auction);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('startPrice', 1);
  object.set('category', 'A string');
  object.set('gallery', [1, 'a string']);
  object.set('status', 1);
  object.set('actualPrice', 1);
  object.set('regionCode', 'A string');
  object.set('countryCode', 'A string');
  object.set('endDate', new Date());
  object.set('title', 'A string');
  object.set('desc', 'A string');
  object.set('buyPrice', 1);
  object.set('currency', 'A string');
  object.set('expireDays', 1);
  object.set('user', new Parse.Object("User"));
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Auction: ${JSON.stringify(response)}`);
    console.log('Updated Auction', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Auction: ${JSON.stringify(error)}`);
    console.error('Error while updating Auction', error);
  });
});

Example Output:

ParseObjectSubclass { className: Auction, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Auction = Parse.Object.extend('Auction');
const query = new Parse.Query(Auction);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Auction: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Auction: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Auction', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Auction");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("startPrice", 1);
        entity.put("category", "A string");
        entity.put("gallery", new JSONArray());
        entity.put("status", 1);
        entity.put("actualPrice", 1);
        entity.put("regionCode", "A string");
        entity.put("countryCode", "A string");
        entity.put("endDate", new Date());
        entity.put("title", "A string");
        entity.put("desc", "A string");
        entity.put("buyPrice", 1);
        entity.put("currency", "A string");
        entity.put("expireDays", 1);
        entity.put("user", new ParseObject("User"));

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Auction")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["startPrice"] = 1
    parseObject["category"] = "A string"
    parseObject["gallery"] = [1, "a string"]
    parseObject["status"] = 1
    parseObject["actualPrice"] = 1
    parseObject["regionCode"] = "A string"
    parseObject["countryCode"] = "A string"
    parseObject["endDate"] = NSDate()
    parseObject["title"] = "A string"
    parseObject["desc"] = "A string"
    parseObject["buyPrice"] = 1
    parseObject["currency"] = "A string"
    parseObject["expireDays"] = 1
    parseObject["user"] = PFObject(className:"User")

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Auction"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"startPrice"] = @1;
    parseObject[@"category"] = @"A string";
    parseObject[@"gallery"] = @[@1, @"a string"];
    parseObject[@"status"] = @1;
    parseObject[@"actualPrice"] = @1;
    parseObject[@"regionCode"] = @"A string";
    parseObject[@"countryCode"] = @"A string";
    parseObject[@"endDate"] = [NSDate date];
    parseObject[@"title"] = @"A string";
    parseObject[@"desc"] = @"A string";
    parseObject[@"buyPrice"] = @1;
    parseObject[@"currency"] = @"A string";
    parseObject[@"expireDays"] = @1;
    parseObject[@"user"] = [PFObject objectWithClassName:@"User"];

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Auction");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["startPrice"] = 1;
myObject["category"] = "A string";
myObject["gallery"] = new List<object>{1, "a string"};
myObject["status"] = 1;
myObject["actualPrice"] = 1;
myObject["regionCode"] = "A string";
myObject["countryCode"] = "A string";
myObject["endDate"] = DateTime.Now;
myObject["title"] = "A string";
myObject["desc"] = "A string";
myObject["buyPrice"] = 1;
myObject["currency"] = "A string";
myObject["expireDays"] = 1;
myObject["user"] = new ParseObject("User");
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("startPrice");
myObject.Remove("category");
myObject.Remove("gallery");
myObject.Remove("status");
myObject.Remove("actualPrice");
myObject.Remove("regionCode");
myObject.Remove("countryCode");
myObject.Remove("endDate");
myObject.Remove("title");
myObject.Remove("desc");
myObject.Remove("buyPrice");
myObject.Remove("currency");
myObject.Remove("expireDays");
myObject.Remove("user");
await myObject.SaveAsync();
$query = new ParseQuery("Auction");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("startPrice", 1);
  $myCustomObject->set("category", "A string");
  $myCustomObject->set("gallery", [1, "a string"]);
  $myCustomObject->set("status", 1);
  $myCustomObject->set("actualPrice", 1);
  $myCustomObject->set("regionCode", "A string");
  $myCustomObject->set("countryCode", "A string");
  $myCustomObject->set("endDate", new DateTime());
  $myCustomObject->set("title", "A string");
  $myCustomObject->set("desc", "A string");
  $myCustomObject->set("buyPrice", 1);
  $myCustomObject->set("currency", "A string");
  $myCustomObject->set("expireDays", 1);
  $myCustomObject->set("user", new ParseObject("User"));

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Auction/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Auction/<OBJECT_ID>

Example Response:

{}

Code:

const Auction = Parse.Object.extend('Auction');
const query = new Parse.Query(Auction);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Auction: ${JSON.stringify(response)}`);
    console.log('Deleted Auction', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Auction: ${JSON.stringify(error)}`);
    console.error('Error while deleting Auction', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Auction', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Auction");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("startPrice");
          entity.remove("category");
          entity.remove("gallery");
          entity.remove("status");
          entity.remove("actualPrice");
          entity.remove("regionCode");
          entity.remove("countryCode");
          entity.remove("endDate");
          entity.remove("title");
          entity.remove("desc");
          entity.remove("buyPrice");
          entity.remove("currency");
          entity.remove("expireDays");
          entity.remove("user");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Auction")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("startPrice")
      parseObject.removeObjectForKey("category")
      parseObject.removeObjectForKey("gallery")
      parseObject.removeObjectForKey("status")
      parseObject.removeObjectForKey("actualPrice")
      parseObject.removeObjectForKey("regionCode")
      parseObject.removeObjectForKey("countryCode")
      parseObject.removeObjectForKey("endDate")
      parseObject.removeObjectForKey("title")
      parseObject.removeObjectForKey("desc")
      parseObject.removeObjectForKey("buyPrice")
      parseObject.removeObjectForKey("currency")
      parseObject.removeObjectForKey("expireDays")
      parseObject.removeObjectForKey("user")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Auction"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"startPrice"];
  // [parseObject removeObjectForKey:@"category"];
  // [parseObject removeObjectForKey:@"gallery"];
  // [parseObject removeObjectForKey:@"status"];
  // [parseObject removeObjectForKey:@"actualPrice"];
  // [parseObject removeObjectForKey:@"regionCode"];
  // [parseObject removeObjectForKey:@"countryCode"];
  // [parseObject removeObjectForKey:@"endDate"];
  // [parseObject removeObjectForKey:@"title"];
  // [parseObject removeObjectForKey:@"desc"];
  // [parseObject removeObjectForKey:@"buyPrice"];
  // [parseObject removeObjectForKey:@"currency"];
  // [parseObject removeObjectForKey:@"expireDays"];
  // [parseObject removeObjectForKey:@"user"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Auction");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Auction");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("startPrice");
  $myCustomObject->delete("category");
  $myCustomObject->delete("gallery");
  $myCustomObject->delete("status");
  $myCustomObject->delete("actualPrice");
  $myCustomObject->delete("regionCode");
  $myCustomObject->delete("countryCode");
  $myCustomObject->delete("endDate");
  $myCustomObject->delete("title");
  $myCustomObject->delete("desc");
  $myCustomObject->delete("buyPrice");
  $myCustomObject->delete("currency");
  $myCustomObject->delete("expireDays");
  $myCustomObject->delete("user");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Auction/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Bid Class

Example JSON:

{
  "status": 1,
  "auction": { "__type": "Pointer", "className": "Auction", "objectId": "<THE_REFERENCED_OBJECT_ID>" },
  "price": 1,
  "user": { "__type": "Pointer", "className": "_User", "objectId": "<THE_REFERENCED_OBJECT_ID>" }
}

Bid is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Bid

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
status Number 1
auction Pointer { "__type": "Pointer", "className": "Auction", "objectId": "<THE_REFERENCED_OBJECT_ID>" }
price Number 1
user Pointer { "__type": "Pointer", "className": "_User", "objectId": "<THE_REFERENCED_OBJECT_ID>" }

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"status\":1,\"auction\":{ \"__type\": \"Pointer\", \"className\": \"Auction\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" },\"price\":1,\"user\":{ \"__type\": \"Pointer\", \"className\": \"_User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Bid

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Bid = Parse.Object.extend('Bid');
const myNewObject = new Bid();

myNewObject.set('status', 1);
myNewObject.set('auction', new Parse.Object("Auction"));
myNewObject.set('price', 1);
myNewObject.set('user', Parse.User.current());

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Bid created: ${JSON.stringify(result)}`);
    console.log('Bid created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Bid: ${JSON.stringify(error)}`);
    console.error('Error while creating Bid: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Bid");

  entity.put("status", 1);
  entity.put("auction", new ParseObject("Auction"));
  entity.put("price", 1);
  entity.put("user", ParseUser.getCurrentUser());

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Bid")

parseObject["status"] = 1
parseObject["auction"] = PFObject(className:"Auction")
parseObject["price"] = 1
parseObject["user"] = PFUser.currentUser()

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Bid"];

parseObject[@"status"] = @1;
parseObject[@"auction"] = [PFObject objectWithClassName:@"Auction"];
parseObject[@"price"] = @1;
parseObject[@"user"] = [PFUser currentUser];

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Bid");
myObject["status"] = 1;
myObject["auction"] = new ParseObject("Auction");
myObject["price"] = 1;
myObject["user"] = ParseUser.CurrentUser;
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Bid");

$myCustomObject->set("status", 1);
$myCustomObject->set("auction", new ParseObject("Auction"));
$myCustomObject->set("price", 1);
$myCustomObject->set("user", ParseUser::getCurrentUser());

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Bid',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Bid class, you'll need to send a POST request to the Bid class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Bid

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Bid/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"status\":1,\"auction\":{ \"__type\": \"Pointer\", \"className\": \"Auction\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" },\"price\":1,\"user\":{ \"__type\": \"Pointer\", \"className\": \"_User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Bid

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "status": 1,"auction": { \"__type\": \"Pointer\", \"className\": \"Auction\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" },"price": 1,"user": { \"__type\": \"Pointer\", \"className\": \"_User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "status": 1,"auction": { \"__type\": \"Pointer\", \"className\": \"Auction\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" },"price": 1,"user": { \"__type\": \"Pointer\", \"className\": \"_User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "status": 1,"auction": { \"__type\": \"Pointer\", \"className\": \"Auction\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" },"price": 1,"user": { \"__type\": \"Pointer\", \"className\": \"_User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" }
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Bid = Parse.Object.extend('Bid');
const query = new Parse.Query(Bid);
query.equalTo("status", 1);
query.equalTo("auction", new Parse.Object("Auction"));
query.equalTo("price", 1);
query.equalTo("user", Parse.User.current());
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Bid found: ${JSON.stringify(results)}`);
  console.log('Bid found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Bid: ${JSON.stringify(error)}`);
  console.error('Error while fetching Bid', error);
});

Example Output:

1 new Parse.Object("Auction") 1 Parse.User.current() 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Bid");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Bid")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Bid"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Bid");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
int status = result.Get<int>("status");
ParseObject auction = result.Get<ParseObject>("auction");
int price = result.Get<int>("price");
ParseObject user = result.Get<ParseObject>("user");
$query = new ParseQuery("Bid");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $status = $myCustomObject->get("status");
  $auction = $myCustomObject->get("auction");
  $price = $myCustomObject->get("price");
  $user = $myCustomObject->get("user");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Bid

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"status\": 1,\"auction\": { \"__type\": \"Pointer\", \"className\": \"Auction\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" },\"price\": 1,\"user\": { \"__type\": \"Pointer\", \"className\": \"_User\", \"objectId\": \"<THE_REFERENCED_OBJECT_ID>\" } }" \
https://parseapi.back4app.com/classes/Bid/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "status": {"__op":"Delete"},"auction": {"__op":"Delete"},"price": {"__op":"Delete"},"user": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Bid

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Bid = Parse.Object.extend('Bid');
const query = new Parse.Query(Bid);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('status', 1);
  object.set('auction', new Parse.Object("Auction"));
  object.set('price', 1);
  object.set('user', Parse.User.current());
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Bid: ${JSON.stringify(response)}`);
    console.log('Updated Bid', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Bid: ${JSON.stringify(error)}`);
    console.error('Error while updating Bid', error);
  });
});

Example Output:

ParseObjectSubclass { className: Bid, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Bid = Parse.Object.extend('Bid');
const query = new Parse.Query(Bid);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Bid: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Bid: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Bid', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Bid");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("status", 1);
        entity.put("auction", new ParseObject("Auction"));
        entity.put("price", 1);
        entity.put("user", ParseUser.getCurrentUser());

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Bid")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["status"] = 1
    parseObject["auction"] = PFObject(className:"Auction")
    parseObject["price"] = 1
    parseObject["user"] = PFUser.currentUser()

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Bid"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"status"] = @1;
    parseObject[@"auction"] = [PFObject objectWithClassName:@"Auction"];
    parseObject[@"price"] = @1;
    parseObject[@"user"] = [PFUser currentUser];

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Bid");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["status"] = 1;
myObject["auction"] = new ParseObject("Auction");
myObject["price"] = 1;
myObject["user"] = ParseUser.CurrentUser;
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("status");
myObject.Remove("auction");
myObject.Remove("price");
myObject.Remove("user");
await myObject.SaveAsync();
$query = new ParseQuery("Bid");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("status", 1);
  $myCustomObject->set("auction", new ParseObject("Auction"));
  $myCustomObject->set("price", 1);
  $myCustomObject->set("user", ParseUser::getCurrentUser());

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Bid/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Bid/<OBJECT_ID>

Example Response:

{}

Code:

const Bid = Parse.Object.extend('Bid');
const query = new Parse.Query(Bid);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Bid: ${JSON.stringify(response)}`);
    console.log('Deleted Bid', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Bid: ${JSON.stringify(error)}`);
    console.error('Error while deleting Bid', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Bid', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Bid");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("status");
          entity.remove("auction");
          entity.remove("price");
          entity.remove("user");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Bid")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("status")
      parseObject.removeObjectForKey("auction")
      parseObject.removeObjectForKey("price")
      parseObject.removeObjectForKey("user")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Bid"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"status"];
  // [parseObject removeObjectForKey:@"auction"];
  // [parseObject removeObjectForKey:@"price"];
  // [parseObject removeObjectForKey:@"user"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Bid");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Bid");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("status");
  $myCustomObject->delete("auction");
  $myCustomObject->delete("price");
  $myCustomObject->delete("user");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Bid/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Lead Class

Example JSON:

{
  "payer": { "foo": "bar" },
  "card": { "foo": "bar" },
  "tag": "A string",
  "lastname": "A string",
  "name": "A string",
  "mobile": "A string",
  "email": "A string",
  "transactionAmount": 1,
  "stripeId": "A string",
  "paymentMethodId": "A string",
  "description": "A string",
  "dateCreated": "A string",
  "dateApproved": "A string",
  "notified": true,
  "status": "A string",
  "paid": true
}

Lead is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Lead

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
payer Object { "foo": "bar" }
card Object { "foo": "bar" }
tag String "A string"
lastname String "A string"
name String "A string"
mobile String "A string"
email String "A string"
transactionAmount Number 1
stripeId String "A string"
paymentMethodId String "A string"
description String "A string"
dateCreated String "A string"
dateApproved String "A string"
notified Boolean true
status String "A string"
paid Boolean true

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"payer\":{ \"foo\": \"bar\" },\"card\":{ \"foo\": \"bar\" },\"tag\":\"A string\",\"lastname\":\"A string\",\"name\":\"A string\",\"mobile\":\"A string\",\"email\":\"A string\",\"transactionAmount\":1,\"stripeId\":\"A string\",\"paymentMethodId\":\"A string\",\"description\":\"A string\",\"dateCreated\":\"A string\",\"dateApproved\":\"A string\",\"notified\":true,\"status\":\"A string\",\"paid\":true }" \
https://parseapi.back4app.com/classes/Lead

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Lead = Parse.Object.extend('Lead');
const myNewObject = new Lead();

myNewObject.set('payer', { foo: 'bar' });
myNewObject.set('card', { foo: 'bar' });
myNewObject.set('tag', 'A string');
myNewObject.set('lastname', 'A string');
myNewObject.set('name', 'A string');
myNewObject.set('mobile', 'A string');
myNewObject.set('email', 'A string');
myNewObject.set('transactionAmount', 1);
myNewObject.set('stripeId', 'A string');
myNewObject.set('paymentMethodId', 'A string');
myNewObject.set('description', 'A string');
myNewObject.set('dateCreated', 'A string');
myNewObject.set('dateApproved', 'A string');
myNewObject.set('notified', true);
myNewObject.set('status', 'A string');
myNewObject.set('paid', true);

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Lead created: ${JSON.stringify(result)}`);
    console.log('Lead created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Lead: ${JSON.stringify(error)}`);
    console.error('Error while creating Lead: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Lead");

  entity.put("payer", new JSONObject());
  entity.put("card", new JSONObject());
  entity.put("tag", "A string");
  entity.put("lastname", "A string");
  entity.put("name", "A string");
  entity.put("mobile", "A string");
  entity.put("email", "A string");
  entity.put("transactionAmount", 1);
  entity.put("stripeId", "A string");
  entity.put("paymentMethodId", "A string");
  entity.put("description", "A string");
  entity.put("dateCreated", "A string");
  entity.put("dateApproved", "A string");
  entity.put("notified", true);
  entity.put("status", "A string");
  entity.put("paid", true);

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Lead")

parseObject["payer"] = [ "foo": "bar" ]
parseObject["card"] = [ "foo": "bar" ]
parseObject["tag"] = "A string"
parseObject["lastname"] = "A string"
parseObject["name"] = "A string"
parseObject["mobile"] = "A string"
parseObject["email"] = "A string"
parseObject["transactionAmount"] = 1
parseObject["stripeId"] = "A string"
parseObject["paymentMethodId"] = "A string"
parseObject["description"] = "A string"
parseObject["dateCreated"] = "A string"
parseObject["dateApproved"] = "A string"
parseObject["notified"] = true
parseObject["status"] = "A string"
parseObject["paid"] = true

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Lead"];

parseObject[@"payer"] = @{ @"foo": @"bar" };
parseObject[@"card"] = @{ @"foo": @"bar" };
parseObject[@"tag"] = @"A string";
parseObject[@"lastname"] = @"A string";
parseObject[@"name"] = @"A string";
parseObject[@"mobile"] = @"A string";
parseObject[@"email"] = @"A string";
parseObject[@"transactionAmount"] = @1;
parseObject[@"stripeId"] = @"A string";
parseObject[@"paymentMethodId"] = @"A string";
parseObject[@"description"] = @"A string";
parseObject[@"dateCreated"] = @"A string";
parseObject[@"dateApproved"] = @"A string";
parseObject[@"notified"] = @YES;
parseObject[@"status"] = @"A string";
parseObject[@"paid"] = @YES;

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Lead");
myObject["payer"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["card"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["tag"] = "A string";
myObject["lastname"] = "A string";
myObject["name"] = "A string";
myObject["mobile"] = "A string";
myObject["email"] = "A string";
myObject["transactionAmount"] = 1;
myObject["stripeId"] = "A string";
myObject["paymentMethodId"] = "A string";
myObject["description"] = "A string";
myObject["dateCreated"] = "A string";
myObject["dateApproved"] = "A string";
myObject["notified"] = true;
myObject["status"] = "A string";
myObject["paid"] = true;
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Lead");

$myCustomObject->set("payer", ["foo" => "bar"]);
$myCustomObject->set("card", ["foo" => "bar"]);
$myCustomObject->set("tag", "A string");
$myCustomObject->set("lastname", "A string");
$myCustomObject->set("name", "A string");
$myCustomObject->set("mobile", "A string");
$myCustomObject->set("email", "A string");
$myCustomObject->set("transactionAmount", 1);
$myCustomObject->set("stripeId", "A string");
$myCustomObject->set("paymentMethodId", "A string");
$myCustomObject->set("description", "A string");
$myCustomObject->set("dateCreated", "A string");
$myCustomObject->set("dateApproved", "A string");
$myCustomObject->set("notified", true);
$myCustomObject->set("status", "A string");
$myCustomObject->set("paid", true);

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Lead',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Lead class, you'll need to send a POST request to the Lead class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Lead

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Lead/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"payer.foo\":\"bar\",\"card.foo\":\"bar\",\"tag\":\"A string\",\"lastname\":\"A string\",\"name\":\"A string\",\"mobile\":\"A string\",\"email\":\"A string\",\"transactionAmount\":1,\"stripeId\":\"A string\",\"paymentMethodId\":\"A string\",\"description\":\"A string\",\"dateCreated\":\"A string\",\"dateApproved\":\"A string\",\"notified\":true,\"status\":\"A string\",\"paid\":true }" \
https://parseapi.back4app.com/classes/Lead

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "payer": { \"foo\": \"bar\" },"card": { \"foo\": \"bar\" },"tag": \"A string\","lastname": \"A string\","name": \"A string\","mobile": \"A string\","email": \"A string\","transactionAmount": 1,"stripeId": \"A string\","paymentMethodId": \"A string\","description": \"A string\","dateCreated": \"A string\","dateApproved": \"A string\","notified": true,"status": \"A string\","paid": true
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "payer": { \"foo\": \"bar\" },"card": { \"foo\": \"bar\" },"tag": \"A string\","lastname": \"A string\","name": \"A string\","mobile": \"A string\","email": \"A string\","transactionAmount": 1,"stripeId": \"A string\","paymentMethodId": \"A string\","description": \"A string\","dateCreated": \"A string\","dateApproved": \"A string\","notified": true,"status": \"A string\","paid": true
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "payer": { \"foo\": \"bar\" },"card": { \"foo\": \"bar\" },"tag": \"A string\","lastname": \"A string\","name": \"A string\","mobile": \"A string\","email": \"A string\","transactionAmount": 1,"stripeId": \"A string\","paymentMethodId": \"A string\","description": \"A string\","dateCreated": \"A string\","dateApproved": \"A string\","notified": true,"status": \"A string\","paid": true
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Lead = Parse.Object.extend('Lead');
const query = new Parse.Query(Lead);
query.equalTo("payer", { foo: 'bar' });
query.equalTo("card", { foo: 'bar' });
query.equalTo("tag", 'A string');
query.equalTo("lastname", 'A string');
query.equalTo("name", 'A string');
query.equalTo("mobile", 'A string');
query.equalTo("email", 'A string');
query.equalTo("transactionAmount", 1);
query.equalTo("stripeId", 'A string');
query.equalTo("paymentMethodId", 'A string');
query.equalTo("description", 'A string');
query.equalTo("dateCreated", 'A string');
query.equalTo("dateApproved", 'A string');
query.equalTo("notified", true);
query.equalTo("status", 'A string');
query.equalTo("paid", true);
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Lead found: ${JSON.stringify(results)}`);
  console.log('Lead found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Lead: ${JSON.stringify(error)}`);
  console.error('Error while fetching Lead', error);
});

Example Output:

{ foo: 'bar' } { foo: 'bar' } 'A string' 'A string' 'A string' 'A string' 'A string' 1 'A string' 'A string' 'A string' 'A string' 'A string' true 'A string' true 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Lead");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Lead")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Lead"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Lead");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
IDictionary payer = result.Get<IDictionary>("payer");
IDictionary card = result.Get<IDictionary>("card");
string tag = result.Get<string>("tag");
string lastname = result.Get<string>("lastname");
string name = result.Get<string>("name");
string mobile = result.Get<string>("mobile");
string email = result.Get<string>("email");
int transactionAmount = result.Get<int>("transactionAmount");
string stripeId = result.Get<string>("stripeId");
string paymentMethodId = result.Get<string>("paymentMethodId");
string description = result.Get<string>("description");
string dateCreated = result.Get<string>("dateCreated");
string dateApproved = result.Get<string>("dateApproved");
bool notified = result.Get<bool>("notified");
string status = result.Get<string>("status");
bool paid = result.Get<bool>("paid");
$query = new ParseQuery("Lead");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $payer = $myCustomObject->get("payer");
  $card = $myCustomObject->get("card");
  $tag = $myCustomObject->get("tag");
  $lastname = $myCustomObject->get("lastname");
  $name = $myCustomObject->get("name");
  $mobile = $myCustomObject->get("mobile");
  $email = $myCustomObject->get("email");
  $transactionAmount = $myCustomObject->get("transactionAmount");
  $stripeId = $myCustomObject->get("stripeId");
  $paymentMethodId = $myCustomObject->get("paymentMethodId");
  $description = $myCustomObject->get("description");
  $dateCreated = $myCustomObject->get("dateCreated");
  $dateApproved = $myCustomObject->get("dateApproved");
  $notified = $myCustomObject->get("notified");
  $status = $myCustomObject->get("status");
  $paid = $myCustomObject->get("paid");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Lead

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"payer\": { \"foo\": \"bar\" },\"card\": { \"foo\": \"bar\" },\"tag\": \"A string\",\"lastname\": \"A string\",\"name\": \"A string\",\"mobile\": \"A string\",\"email\": \"A string\",\"transactionAmount\": 1,\"stripeId\": \"A string\",\"paymentMethodId\": \"A string\",\"description\": \"A string\",\"dateCreated\": \"A string\",\"dateApproved\": \"A string\",\"notified\": true,\"status\": \"A string\",\"paid\": true }" \
https://parseapi.back4app.com/classes/Lead/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "payer": {"__op":"Delete"},"card": {"__op":"Delete"},"tag": {"__op":"Delete"},"lastname": {"__op":"Delete"},"name": {"__op":"Delete"},"mobile": {"__op":"Delete"},"email": {"__op":"Delete"},"transactionAmount": {"__op":"Delete"},"stripeId": {"__op":"Delete"},"paymentMethodId": {"__op":"Delete"},"description": {"__op":"Delete"},"dateCreated": {"__op":"Delete"},"dateApproved": {"__op":"Delete"},"notified": {"__op":"Delete"},"status": {"__op":"Delete"},"paid": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Lead

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Lead = Parse.Object.extend('Lead');
const query = new Parse.Query(Lead);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('payer', { foo: 'bar' });
  object.set('card', { foo: 'bar' });
  object.set('tag', 'A string');
  object.set('lastname', 'A string');
  object.set('name', 'A string');
  object.set('mobile', 'A string');
  object.set('email', 'A string');
  object.set('transactionAmount', 1);
  object.set('stripeId', 'A string');
  object.set('paymentMethodId', 'A string');
  object.set('description', 'A string');
  object.set('dateCreated', 'A string');
  object.set('dateApproved', 'A string');
  object.set('notified', true);
  object.set('status', 'A string');
  object.set('paid', true);
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Lead: ${JSON.stringify(response)}`);
    console.log('Updated Lead', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Lead: ${JSON.stringify(error)}`);
    console.error('Error while updating Lead', error);
  });
});

Example Output:

ParseObjectSubclass { className: Lead, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Lead = Parse.Object.extend('Lead');
const query = new Parse.Query(Lead);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Lead: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Lead: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Lead', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Lead");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("payer", new JSONObject());
        entity.put("card", new JSONObject());
        entity.put("tag", "A string");
        entity.put("lastname", "A string");
        entity.put("name", "A string");
        entity.put("mobile", "A string");
        entity.put("email", "A string");
        entity.put("transactionAmount", 1);
        entity.put("stripeId", "A string");
        entity.put("paymentMethodId", "A string");
        entity.put("description", "A string");
        entity.put("dateCreated", "A string");
        entity.put("dateApproved", "A string");
        entity.put("notified", true);
        entity.put("status", "A string");
        entity.put("paid", true);

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Lead")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["payer"] = [ "foo": "bar" ]
    parseObject["card"] = [ "foo": "bar" ]
    parseObject["tag"] = "A string"
    parseObject["lastname"] = "A string"
    parseObject["name"] = "A string"
    parseObject["mobile"] = "A string"
    parseObject["email"] = "A string"
    parseObject["transactionAmount"] = 1
    parseObject["stripeId"] = "A string"
    parseObject["paymentMethodId"] = "A string"
    parseObject["description"] = "A string"
    parseObject["dateCreated"] = "A string"
    parseObject["dateApproved"] = "A string"
    parseObject["notified"] = true
    parseObject["status"] = "A string"
    parseObject["paid"] = true

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Lead"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"payer"] = @{ @"foo": @"bar" };
    parseObject[@"card"] = @{ @"foo": @"bar" };
    parseObject[@"tag"] = @"A string";
    parseObject[@"lastname"] = @"A string";
    parseObject[@"name"] = @"A string";
    parseObject[@"mobile"] = @"A string";
    parseObject[@"email"] = @"A string";
    parseObject[@"transactionAmount"] = @1;
    parseObject[@"stripeId"] = @"A string";
    parseObject[@"paymentMethodId"] = @"A string";
    parseObject[@"description"] = @"A string";
    parseObject[@"dateCreated"] = @"A string";
    parseObject[@"dateApproved"] = @"A string";
    parseObject[@"notified"] = @YES;
    parseObject[@"status"] = @"A string";
    parseObject[@"paid"] = @YES;

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Lead");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["payer"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["card"] = new Dictionary<string, object> { { "number", number }, { "string", str } };
myObject["tag"] = "A string";
myObject["lastname"] = "A string";
myObject["name"] = "A string";
myObject["mobile"] = "A string";
myObject["email"] = "A string";
myObject["transactionAmount"] = 1;
myObject["stripeId"] = "A string";
myObject["paymentMethodId"] = "A string";
myObject["description"] = "A string";
myObject["dateCreated"] = "A string";
myObject["dateApproved"] = "A string";
myObject["notified"] = true;
myObject["status"] = "A string";
myObject["paid"] = true;
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("payer");
myObject.Remove("card");
myObject.Remove("tag");
myObject.Remove("lastname");
myObject.Remove("name");
myObject.Remove("mobile");
myObject.Remove("email");
myObject.Remove("transactionAmount");
myObject.Remove("stripeId");
myObject.Remove("paymentMethodId");
myObject.Remove("description");
myObject.Remove("dateCreated");
myObject.Remove("dateApproved");
myObject.Remove("notified");
myObject.Remove("status");
myObject.Remove("paid");
await myObject.SaveAsync();
$query = new ParseQuery("Lead");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("payer", ["foo" => "bar"]);
  $myCustomObject->set("card", ["foo" => "bar"]);
  $myCustomObject->set("tag", "A string");
  $myCustomObject->set("lastname", "A string");
  $myCustomObject->set("name", "A string");
  $myCustomObject->set("mobile", "A string");
  $myCustomObject->set("email", "A string");
  $myCustomObject->set("transactionAmount", 1);
  $myCustomObject->set("stripeId", "A string");
  $myCustomObject->set("paymentMethodId", "A string");
  $myCustomObject->set("description", "A string");
  $myCustomObject->set("dateCreated", "A string");
  $myCustomObject->set("dateApproved", "A string");
  $myCustomObject->set("notified", true);
  $myCustomObject->set("status", "A string");
  $myCustomObject->set("paid", true);

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Lead/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Lead/<OBJECT_ID>

Example Response:

{}

Code:

const Lead = Parse.Object.extend('Lead');
const query = new Parse.Query(Lead);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Lead: ${JSON.stringify(response)}`);
    console.log('Deleted Lead', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Lead: ${JSON.stringify(error)}`);
    console.error('Error while deleting Lead', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Lead', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Lead");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("payer");
          entity.remove("card");
          entity.remove("tag");
          entity.remove("lastname");
          entity.remove("name");
          entity.remove("mobile");
          entity.remove("email");
          entity.remove("transactionAmount");
          entity.remove("stripeId");
          entity.remove("paymentMethodId");
          entity.remove("description");
          entity.remove("dateCreated");
          entity.remove("dateApproved");
          entity.remove("notified");
          entity.remove("status");
          entity.remove("paid");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Lead")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("payer")
      parseObject.removeObjectForKey("card")
      parseObject.removeObjectForKey("tag")
      parseObject.removeObjectForKey("lastname")
      parseObject.removeObjectForKey("name")
      parseObject.removeObjectForKey("mobile")
      parseObject.removeObjectForKey("email")
      parseObject.removeObjectForKey("transactionAmount")
      parseObject.removeObjectForKey("stripeId")
      parseObject.removeObjectForKey("paymentMethodId")
      parseObject.removeObjectForKey("description")
      parseObject.removeObjectForKey("dateCreated")
      parseObject.removeObjectForKey("dateApproved")
      parseObject.removeObjectForKey("notified")
      parseObject.removeObjectForKey("status")
      parseObject.removeObjectForKey("paid")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Lead"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"payer"];
  // [parseObject removeObjectForKey:@"card"];
  // [parseObject removeObjectForKey:@"tag"];
  // [parseObject removeObjectForKey:@"lastname"];
  // [parseObject removeObjectForKey:@"name"];
  // [parseObject removeObjectForKey:@"mobile"];
  // [parseObject removeObjectForKey:@"email"];
  // [parseObject removeObjectForKey:@"transactionAmount"];
  // [parseObject removeObjectForKey:@"stripeId"];
  // [parseObject removeObjectForKey:@"paymentMethodId"];
  // [parseObject removeObjectForKey:@"description"];
  // [parseObject removeObjectForKey:@"dateCreated"];
  // [parseObject removeObjectForKey:@"dateApproved"];
  // [parseObject removeObjectForKey:@"notified"];
  // [parseObject removeObjectForKey:@"status"];
  // [parseObject removeObjectForKey:@"paid"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Lead");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Lead");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("payer");
  $myCustomObject->delete("card");
  $myCustomObject->delete("tag");
  $myCustomObject->delete("lastname");
  $myCustomObject->delete("name");
  $myCustomObject->delete("mobile");
  $myCustomObject->delete("email");
  $myCustomObject->delete("transactionAmount");
  $myCustomObject->delete("stripeId");
  $myCustomObject->delete("paymentMethodId");
  $myCustomObject->delete("description");
  $myCustomObject->delete("dateCreated");
  $myCustomObject->delete("dateApproved");
  $myCustomObject->delete("notified");
  $myCustomObject->delete("status");
  $myCustomObject->delete("paid");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Lead/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Students Class

Example JSON:

{
  "age": 1,
  "Name": "A string"
}

Students is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Students

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
age Number 1
Name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"age\":1,\"Name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Students

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Students = Parse.Object.extend('Students');
const myNewObject = new Students();

myNewObject.set('age', 1);
myNewObject.set('Name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Students created: ${JSON.stringify(result)}`);
    console.log('Students created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Students: ${JSON.stringify(error)}`);
    console.error('Error while creating Students: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Students");

  entity.put("age", 1);
  entity.put("Name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Students")

parseObject["age"] = 1
parseObject["Name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Students"];

parseObject[@"age"] = @1;
parseObject[@"Name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Students");
myObject["age"] = 1;
myObject["Name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Students");

$myCustomObject->set("age", 1);
$myCustomObject->set("Name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Students',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Students class, you'll need to send a POST request to the Students class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Students

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Students/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"age\":1,\"Name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Students

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "age": 1,"Name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "age": 1,"Name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "age": 1,"Name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Students = Parse.Object.extend('Students');
const query = new Parse.Query(Students);
query.equalTo("age", 1);
query.equalTo("Name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Students found: ${JSON.stringify(results)}`);
  console.log('Students found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Students: ${JSON.stringify(error)}`);
  console.error('Error while fetching Students', error);
});

Example Output:

1 'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Students");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Students")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Students"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Students");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
int age = result.Get<int>("age");
string Name = result.Get<string>("Name");
$query = new ParseQuery("Students");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $age = $myCustomObject->get("age");
  $Name = $myCustomObject->get("Name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Students

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"age\": 1,\"Name\": \"A string\" }" \
https://parseapi.back4app.com/classes/Students/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "age": {"__op":"Delete"},"Name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Students

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Students = Parse.Object.extend('Students');
const query = new Parse.Query(Students);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('age', 1);
  object.set('Name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Students: ${JSON.stringify(response)}`);
    console.log('Updated Students', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Students: ${JSON.stringify(error)}`);
    console.error('Error while updating Students', error);
  });
});

Example Output:

ParseObjectSubclass { className: Students, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Students = Parse.Object.extend('Students');
const query = new Parse.Query(Students);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Students: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Students: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Students', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Students");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("age", 1);
        entity.put("Name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Students")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["age"] = 1
    parseObject["Name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Students"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"age"] = @1;
    parseObject[@"Name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Students");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["age"] = 1;
myObject["Name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("age");
myObject.Remove("Name");
await myObject.SaveAsync();
$query = new ParseQuery("Students");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("age", 1);
  $myCustomObject->set("Name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Students/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Students/<OBJECT_ID>

Example Response:

{}

Code:

const Students = Parse.Object.extend('Students');
const query = new Parse.Query(Students);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Students: ${JSON.stringify(response)}`);
    console.log('Deleted Students', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Students: ${JSON.stringify(error)}`);
    console.error('Error while deleting Students', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Students', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Students");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("age");
          entity.remove("Name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Students")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("age")
      parseObject.removeObjectForKey("Name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Students"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"age"];
  // [parseObject removeObjectForKey:@"Name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Students");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Students");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("age");
  $myCustomObject->delete("Name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Students/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Continentscountriescities_City Class

Example JSON:

{
  "myCustomKey1Name": "A string",
  "myCustomKey2Name": "A string"
}

Continentscountriescities_City is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/Continentscountriescities_City

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
myCustomKey1Name String "A string"
myCustomKey2Name String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Continentscountriescities_City

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const Continentscountriescities_City = Parse.Object.extend('Continentscountriescities_City');
const myNewObject = new Continentscountriescities_City();

myNewObject.set('myCustomKey1Name', 'A string');
myNewObject.set('myCustomKey2Name', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`Continentscountriescities_City created: ${JSON.stringify(result)}`);
    console.log('Continentscountriescities_City created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating Continentscountriescities_City: ${JSON.stringify(error)}`);
    console.error('Error while creating Continentscountriescities_City: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("Continentscountriescities_City");

  entity.put("myCustomKey1Name", "A string");
  entity.put("myCustomKey2Name", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"Continentscountriescities_City")

parseObject["myCustomKey1Name"] = "A string"
parseObject["myCustomKey2Name"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"Continentscountriescities_City"];

parseObject[@"myCustomKey1Name"] = @"A string";
parseObject[@"myCustomKey2Name"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("Continentscountriescities_City");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("Continentscountriescities_City");

$myCustomObject->set("myCustomKey1Name", "A string");
$myCustomObject->set("myCustomKey2Name", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'Continentscountriescities_City',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the Continentscountriescities_City class, you'll need to send a POST request to the Continentscountriescities_City class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Continentscountriescities_City

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/Continentscountriescities_City/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"myCustomKey1Name\":\"A string\",\"myCustomKey2Name\":\"A string\" }" \
https://parseapi.back4app.com/classes/Continentscountriescities_City

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "myCustomKey1Name": \"A string\","myCustomKey2Name": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const Continentscountriescities_City = Parse.Object.extend('Continentscountriescities_City');
const query = new Parse.Query(Continentscountriescities_City);
query.equalTo("myCustomKey1Name", 'A string');
query.equalTo("myCustomKey2Name", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`Continentscountriescities_City found: ${JSON.stringify(results)}`);
  console.log('Continentscountriescities_City found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching Continentscountriescities_City: ${JSON.stringify(error)}`);
  console.error('Error while fetching Continentscountriescities_City', error);
});

Example Output:

'A string' 'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Continentscountriescities_City");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"Continentscountriescities_City")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Continentscountriescities_City"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Continentscountriescities_City");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string myCustomKey1Name = result.Get<string>("myCustomKey1Name");
string myCustomKey2Name = result.Get<string>("myCustomKey2Name");
$query = new ParseQuery("Continentscountriescities_City");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $myCustomKey1Name = $myCustomObject->get("myCustomKey1Name");
  $myCustomKey2Name = $myCustomObject->get("myCustomKey2Name");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Continentscountriescities_City

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"myCustomKey1Name\": \"A string\",\"myCustomKey2Name\": \"A string\" }" \
https://parseapi.back4app.com/classes/Continentscountriescities_City/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "myCustomKey1Name": {"__op":"Delete"},"myCustomKey2Name": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/Continentscountriescities_City

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const Continentscountriescities_City = Parse.Object.extend('Continentscountriescities_City');
const query = new Parse.Query(Continentscountriescities_City);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('myCustomKey1Name', 'A string');
  object.set('myCustomKey2Name', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated Continentscountriescities_City: ${JSON.stringify(response)}`);
    console.log('Updated Continentscountriescities_City', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating Continentscountriescities_City: ${JSON.stringify(error)}`);
    console.error('Error while updating Continentscountriescities_City', error);
  });
});

Example Output:

ParseObjectSubclass { className: Continentscountriescities_City, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const Continentscountriescities_City = Parse.Object.extend('Continentscountriescities_City');
const query = new Parse.Query(Continentscountriescities_City);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated Continentscountriescities_City: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating Continentscountriescities_City: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'Continentscountriescities_City', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Continentscountriescities_City");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("myCustomKey1Name", "A string");
        entity.put("myCustomKey2Name", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"Continentscountriescities_City")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["myCustomKey1Name"] = "A string"
    parseObject["myCustomKey2Name"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Continentscountriescities_City"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"myCustomKey1Name"] = @"A string";
    parseObject[@"myCustomKey2Name"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("Continentscountriescities_City");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["myCustomKey1Name"] = "A string";
myObject["myCustomKey2Name"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("myCustomKey1Name");
myObject.Remove("myCustomKey2Name");
await myObject.SaveAsync();
$query = new ParseQuery("Continentscountriescities_City");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("myCustomKey1Name", "A string");
  $myCustomObject->set("myCustomKey2Name", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Continentscountriescities_City/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/Continentscountriescities_City/<OBJECT_ID>

Example Response:

{}

Code:

const Continentscountriescities_City = Parse.Object.extend('Continentscountriescities_City');
const query = new Parse.Query(Continentscountriescities_City);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted Continentscountriescities_City: ${JSON.stringify(response)}`);
    console.log('Deleted Continentscountriescities_City', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting Continentscountriescities_City: ${JSON.stringify(error)}`);
    console.error('Error while deleting Continentscountriescities_City', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'Continentscountriescities_City', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("Continentscountriescities_City");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("myCustomKey1Name");
          entity.remove("myCustomKey2Name");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"Continentscountriescities_City")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("myCustomKey1Name")
      parseObject.removeObjectForKey("myCustomKey2Name")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"Continentscountriescities_City"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"myCustomKey1Name"];
  // [parseObject removeObjectForKey:@"myCustomKey2Name"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("Continentscountriescities_City");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("Continentscountriescities_City");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("myCustomKey1Name");
  $myCustomObject->delete("myCustomKey2Name");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/Continentscountriescities_City/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

DeliveryCallback Class

Example JSON:

{
  "restaurant": "A string",
  "callFrom": "A string",
  "orderNumber": "A string",
  "status": "A string"
}

DeliveryCallback is a custom class that was created and is specific for Back4Press. Please use the following documentation to learn how to perform CRUD (create, read, update and delete) operations to this specific class. A new endpoint was automatically generated at the address below to which you can send your requests:

https://parseapi.back4app.com/classes/DeliveryCallback

The following fields are supported by this class' schema and can be used in the operations:

Name Type Example
restaurant String "A string"
callFrom String "A string"
orderNumber String "A string"
status String "A string"

Creating Objects

Example Request:

curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"restaurant\":\"A string\",\"callFrom\":\"A string\",\"orderNumber\":\"A string\",\"status\":\"A string\" }" \
https://parseapi.back4app.com/classes/DeliveryCallback

Example Response:

{
  "objectId": "4BwpMWdCnm",
  "createdAt": "2018-11-06T00:52:01.520Z"
}

Code:

const DeliveryCallback = Parse.Object.extend('DeliveryCallback');
const myNewObject = new DeliveryCallback();

myNewObject.set('restaurant', 'A string');
myNewObject.set('callFrom', 'A string');
myNewObject.set('orderNumber', 'A string');
myNewObject.set('status', 'A string');

myNewObject.save().then(
  (result) => {
    if (typeof document !== 'undefined') document.write(`DeliveryCallback created: ${JSON.stringify(result)}`);
    console.log('DeliveryCallback created', result);
  },
  (error) => {
    if (typeof document !== 'undefined') document.write(`Error while creating DeliveryCallback: ${JSON.stringify(error)}`);
    console.error('Error while creating DeliveryCallback: ', error);
  }
);
import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;
import com.parse.SaveCallback;

public void createObject() {
  ParseObject entity = new ParseObject("DeliveryCallback");

  entity.put("restaurant", "A string");
  entity.put("callFrom", "A string");
  entity.put("orderNumber", "A string");
  entity.put("status", "A string");

  // Saves the new object.
  // Notice that the SaveCallback is totally optional!
  entity.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
      // Here you can handle errors, if thrown. Otherwise, "e" should be null
    }
  });
}
var parseObject = PFObject(className:"DeliveryCallback")

parseObject["restaurant"] = "A string"
parseObject["callFrom"] = "A string"
parseObject["orderNumber"] = "A string"
parseObject["status"] = "A string"

// Saves the new object.
parseObject.saveInBackground {
  (success: Bool, error: Error?) in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}
PFObject *parseObject = [PFObject objectWithClassName:@"DeliveryCallback"];

parseObject[@"restaurant"] = @"A string";
parseObject[@"callFrom"] = @"A string";
parseObject[@"orderNumber"] = @"A string";
parseObject[@"status"] = @"A string";

[parseObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}];
ParseObject myObject = new ParseObject("DeliveryCallback");
myObject["restaurant"] = "A string";
myObject["callFrom"] = "A string";
myObject["orderNumber"] = "A string";
myObject["status"] = "A string";
await myObject.SaveAsync();
$myCustomObject = new ParseObject("DeliveryCallback");

$myCustomObject->set("restaurant", "A string");
$myCustomObject->set("callFrom", "A string");
$myCustomObject->set("orderNumber", "A string");
$myCustomObject->set("status", "A string");

try {
  $myCustomObject->save();
  echo 'New object created with objectId: ' . $myCustomObject->getObjectId();
} catch (ParseException $ex) {
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}

Example Output:

ParseObjectSubclass {
  className: 'DeliveryCallback',
  _objCount: 0,
  id: '4BwpMWdCnm'
}

To create a new object of the DeliveryCallback class, you'll need to send a POST request to the DeliveryCallback class' endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs of the supported fields as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/DeliveryCallback

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data according to the supported fields.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/classes/DeliveryCallback/MyNewObjectId

The Location header will contain the endpoint of the newly-created object.

Body

A JSON document with the objectId and createdAt fields of the newly-created object.

Error Response

Please check the Errors section.

Reading Objects

Example Request:

curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-G \
--data-urlencode "where={ \"restaurant\":\"A string\",\"callFrom\":\"A string\",\"orderNumber\":\"A string\",\"status\":\"A string\" }" \
https://parseapi.back4app.com/classes/DeliveryCallback

Example Response:

{
  "results": [
    {
      "objectId": "zJxVP17mTi",
      "createdAt": "2018-10-31T14:16:13.616Z",
      "updatedAt": "2018-11-07T12:12:20.758Z",
      "restaurant": \"A string\","callFrom": \"A string\","orderNumber": \"A string\","status": \"A string\"
    },
    {
      "objectId": "yDbv0gKGJR",
      "createdAt": "2018-10-31T14:16:42.811Z",
      "updatedAt": "2018-11-07T12:12:18.543Z",
      "restaurant": \"A string\","callFrom": \"A string\","orderNumber": \"A string\","status": \"A string\"
    },
    {
      "objectId": "xKue915KBG",
      "createdAt": "2018-11-07T12:11:58.533Z",
      "updatedAt": "2018-11-07T12:12:15.413Z",
      "restaurant": \"A string\","callFrom": \"A string\","orderNumber": \"A string\","status": \"A string\"
    }
  ]
}

Without any URL parameters, this simply lists all objects in the class.

Learn more about query parameters in queries section.

Code:

const DeliveryCallback = Parse.Object.extend('DeliveryCallback');
const query = new Parse.Query(DeliveryCallback);
query.equalTo("restaurant", 'A string');
query.equalTo("callFrom", 'A string');
query.equalTo("orderNumber", 'A string');
query.equalTo("status", 'A string');
query.find().then((results) => {
  // You can use the "get" method to get the value of an attribute
  // Ex: response.get("<ATTRIBUTE_NAME>")
  if (typeof document !== 'undefined') document.write(`DeliveryCallback found: ${JSON.stringify(results)}`);
  console.log('DeliveryCallback found', results);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching DeliveryCallback: ${JSON.stringify(error)}`);
  console.error('Error while fetching DeliveryCallback', error);
});

Example Output:

'A string' 'A string' 'A string' 'A string' 

To get the values out of the Parse.Object, use the get method.

Learn more about query parameters in queries section.

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void readObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("DeliveryCallback");

  // The query will search for a ParseObject, given its objectId.
  // When the query finishes running, it will invoke the GetCallback
  // with either the object, or the exception thrown
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject result, ParseException e) {
      if (e == null) {
        System.out.println(result);
      } else {
        // something went wrong
      }
    }
  });
}
var query = PFQuery(className:"DeliveryCallback")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error == nil && parseObject != nil {
    print(parseObject)
  } else {
    print(error)
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"DeliveryCallback"];
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
    // Do something with the returned PFObject in the parseObject variable.
    NSLog(@"%@", parseObject);
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("DeliveryCallback");
ParseObject result = await query.GetAsync("<PARSE_OBJECT_ID>");
// Use the Get<T> method to get the values
string restaurant = result.Get<string>("restaurant");
string callFrom = result.Get<string>("callFrom");
string orderNumber = result.Get<string>("orderNumber");
string status = result.Get<string>("status");
$query = new ParseQuery("DeliveryCallback");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // To get attributes, you can use the "get" method, providing the attribute name:
  $restaurant = $myCustomObject->get("restaurant");
  $callFrom = $myCustomObject->get("callFrom");
  $orderNumber = $myCustomObject->get("orderNumber");
  $status = $myCustomObject->get("status");
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To retrieve an object, you'll need to send a GET request to its class endpoint with your app's credentials in the headers and the query parameters in the URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/DeliveryCallback

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Parameters

A where URL parameter constraining the value for keys. It should be encoded JSON.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a results field with a JSON array that lists the objects.

Error Response

Please check the Errors section.

Updating Objects

Example Request:


# Don't forget to set the OBJECT_ID parameter
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d "{ \"restaurant\": \"A string\",\"callFrom\": \"A string\",\"orderNumber\": \"A string\",\"status\": \"A string\" }" \
https://parseapi.back4app.com/classes/DeliveryCallback/<OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You can delete a single field from an object by using the Delete operation:

Example Request:


curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{ "restaurant": {"__op":"Delete"},"callFrom": {"__op":"Delete"},"orderNumber": {"__op":"Delete"},"status": {"__op":"Delete"} }' \
https://parseapi.back4app.com/classes/DeliveryCallback

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

Code:

const DeliveryCallback = Parse.Object.extend('DeliveryCallback');
const query = new Parse.Query(DeliveryCallback);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  object.set('restaurant', 'A string');
  object.set('callFrom', 'A string');
  object.set('orderNumber', 'A string');
  object.set('status', 'A string');
  object.save().then((response) => {
    // You can use the "get" method to get the value of an attribute
    // Ex: response.get("<ATTRIBUTE_NAME>")
    if (typeof document !== 'undefined') document.write(`Updated DeliveryCallback: ${JSON.stringify(response)}`);
    console.log('Updated DeliveryCallback', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating DeliveryCallback: ${JSON.stringify(error)}`);
    console.error('Error while updating DeliveryCallback', error);
  });
});

Example Output:

ParseObjectSubclass { className: DeliveryCallback, _objCount: 0, id: 'xKue915KBG' }

You can delete a single field from an object with the unset method:

const DeliveryCallback = Parse.Object.extend('DeliveryCallback');
const query = new Parse.Query(DeliveryCallback);
// here you put the objectId that you want to update
query.get('xKue915KBG').then((object) => {
  // After this, the myCustomKeyName field will be empty
  object.unset('name');

  object.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated DeliveryCallback: ${JSON.stringify(response)}`);
    console.log(response);
  })
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while updating DeliveryCallback: ${JSON.stringify(error)}`);
  console.error(error);
});

Example Output:

ParseObjectSubclass { className: 'DeliveryCallback', _objCount: 0, id: 'xKue915KBG' }

Please note that use of object.set(null) to remove a field from an object is not recommended and will result in unexpected functionality.

import java.util.Date;
import javax.json.JSONArray;
import javax.json.JSONObject;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseRelation;

public void updateObject() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("DeliveryCallback");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        // Update the fields we want to
        entity.put("restaurant", "A string");
        entity.put("callFrom", "A string");
        entity.put("orderNumber", "A string");
        entity.put("status", "A string");

        // All other fields will remain the same
        entity.saveInBackground();
      }
    }
  });
}
var query = PFQuery(className:"DeliveryCallback")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    parseObject["restaurant"] = "A string"
    parseObject["callFrom"] = "A string"
    parseObject["orderNumber"] = "A string"
    parseObject["status"] = "A string"

    parseObject.saveInBackground()
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"DeliveryCallback"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>"
                             block:^(PFObject *parseObject, NSError *error) {
    parseObject[@"restaurant"] = @"A string";
    parseObject[@"callFrom"] = @"A string";
    parseObject[@"orderNumber"] = @"A string";
    parseObject[@"status"] = @"A string";

    [parseObject saveInBackground];
}];
ParseQuery<ParseObject> query = ParseObject.GetQuery("DeliveryCallback");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject["restaurant"] = "A string";
myObject["callFrom"] = "A string";
myObject["orderNumber"] = "A string";
myObject["status"] = "A string";
await myObject.SaveAsync();

You can delete a single field from an object with the Remove method:

ParseQuery<ParseObject> query = ParseObject.GetQuery("MyCustomClassName");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
myObject.Remove("restaurant");
myObject.Remove("callFrom");
myObject.Remove("orderNumber");
myObject.Remove("status");
await myObject.SaveAsync();
$query = new ParseQuery("DeliveryCallback");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // Update any data you want with the "set" method,
  // providing the attribute name and the new value
  $myCustomObject->set("restaurant", "A string");
  $myCustomObject->set("callFrom", "A string");
  $myCustomObject->set("orderNumber", "A string");
  $myCustomObject->set("status", "A string");

  // And then save your changes
  $myCustomObject->save();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To update data on an object that already exists, send a PUT request to this object endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/DeliveryCallback/MyCurrentObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the object's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Objects

Example Request:

# Don't forget to set the OBJECT_ID parameter
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/classes/DeliveryCallback/<OBJECT_ID>

Example Response:

{}

Code:

const DeliveryCallback = Parse.Object.extend('DeliveryCallback');
const query = new Parse.Query(DeliveryCallback);
// here you put the objectId that you want to delete
query.get('xKue915KBG').then((object) => {
  object.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted DeliveryCallback: ${JSON.stringify(response)}`);
    console.log('Deleted DeliveryCallback', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting DeliveryCallback: ${JSON.stringify(error)}`);
    console.error('Error while deleting DeliveryCallback', error);
  });
});

Example Output:

ParseObjectSubclass { className: 'DeliveryCallback', _objCount: 0, id: 'xKue915KBG' }
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public void deleteObject() {
  // TODO: modify me!
  final boolean deleteAttributesOnly = true;

  ParseQuery<ParseObject> query = ParseQuery.getQuery("DeliveryCallback");

  // Retrieve the object by id
  query.getInBackground("<PARSE_OBJECT_ID>", new GetCallback<ParseObject>() {
    public void done(ParseObject entity, ParseException e) {
      if (e == null) {
        if (deleteAttributesOnly) {
          // If you want to undefine a specific field, do this:
          entity.remove("restaurant");
          entity.remove("callFrom");
          entity.remove("orderNumber");
          entity.remove("status");

          // Then save the changes
          entity.saveInBackground();
        } else {
          // Otherwise, you can delete the entire ParseObject from the database
          entity.deleteInBackground();
        }
      }
    }
  });
}
var deleteAttributesOnly = true

var query = PFQuery(className:"DeliveryCallback")

query.getObjectInBackgroundWithId("<PARSE_OBJECT_ID>") {
  (parseObject: PFObject?, error: NSError?) -> Void in
  if error != nil {
    print(error)
  } else if parseObject != nil {
    if deleteAttributesOnly {
      parseObject.removeObjectForKey("restaurant")
      parseObject.removeObjectForKey("callFrom")
      parseObject.removeObjectForKey("orderNumber")
      parseObject.removeObjectForKey("status")
      parseObject.saveInBackground()
    } else {
      parseObject.deleteInBackground()
    }
  }
}
PFQuery *query = [PFQuery queryWithClassName:@"DeliveryCallback"];

// Retrieve the object by id
[query getObjectInBackgroundWithId:@"<PARSE_OBJECT_ID>" block:^(PFObject *parseObject, NSError *error) {
  // When using "removeObjectForKey", the field will be empty
  // [parseObject removeObjectForKey:@"restaurant"];
  // [parseObject removeObjectForKey:@"callFrom"];
  // [parseObject removeObjectForKey:@"orderNumber"];
  // [parseObject removeObjectForKey:@"status"];
  // Saves the field deletion to the Parse Cloud
  // [parseObject saveInBackground];

  // Or you can delete the entire object from the database
  [parseObject deleteInBackground];
}
ParseQuery<ParseObject> query = ParseObject.GetQuery("DeliveryCallback");
ParseObject myObject = await query.GetAsync("<PARSE_OBJECT_ID>");
await myObject.DeleteAsync();
$query = new ParseQuery("DeliveryCallback");
try {
  $myCustomObject = $query->get("<PARSE_OBJECT_ID>");
  // The object was retrieved successfully.

  // After this, the field will be empty
  $myCustomObject->delete("restaurant");
  $myCustomObject->delete("callFrom");
  $myCustomObject->delete("orderNumber");
  $myCustomObject->delete("status");
  // Saves any changes done to the object
  $myCustomObject->save();

  // Otherwise, you can delete the entire object from the database
  $myCustomObject->destroy();
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

To delete an object send a DELETE request to this object endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/classes/DeliveryCallback/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

User API

Example Object:

{
  "objectId": "4BwpMWdCnm",
  "username": "A string",
  "email": "A string",
  "confirmPassword": "A string",
  "name": "A string",
  "points": "A string",
  "p": 1,
  "countryCode": "A string",
  "RunCount": 1,
  "regionCode": "A string",
  "favorites": [1, "a string"],
  "password": "#Password123",
  "createdAt": "2018-11-06T00:52:01.520Z",
  "updatedAt": "2018-11-06T00:52:04.713Z"
}

The special keys objectId, createdAt and updatedAt are default and always automatically created by the platform.

User is a subclass of Object, what meanings that has the same properties and methods as a generic object. The difference is that Parse.User has some special additions specific to user accounts.

As others objects, users have a flexible schema, the differences are that the username and password fields are required and username and email must be unique per user.

For each new custom class that you create in your app's schema (either through API or just sending the data), a new endpoint is generated at the address below through which you can perform your CRUD operations:

https://parseapi.back4app.com/user/MyCurrentUserObjectId

Signing Up

Example Request:

# Don't forget to set your own User data!
curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "X-Parse-Revocable-Session: 1" \
-H "Content-Type: application/json" \
-d "{ \"password\":\"#Password123\", \"username\": \"A string\",\"email\": \"A string\",\"confirmPassword\": \"A string\",\"name\": \"A string\",\"points\": \"A string\",\"p\": 1,\"countryCode\": \"A string\",\"RunCount\": 1,\"regionCode\": \"A string\",\"favorites\": [ 1, \"a string\" ] }" \
https://parseapi.back4app.com/users

Example Response:

{ "objectId":"nr7hAYS43a","createdAt":"2018-11-08T13:08:42.914Z","sessionToken":"r:35c2ae1c1def6c38a469e41ce671cb7e" }

Code:

const user = new Parse.User()
user.set('username', 'A string');
user.set('email', 'A string');
user.set('confirmPassword', 'A string');
user.set('name', 'A string');
user.set('points', 'A string');
user.set('p', 1);
user.set('countryCode', 'A string');
user.set('RunCount', 1);
user.set('regionCode', 'A string');
user.set('favorites', [1, 'a string']);
user.set('password', '#Password123');

user.signUp().then((user) => {
  if (typeof document !== 'undefined') document.write(`User signed up: ${JSON.stringify(user)}`);
  console.log('User signed up', user);
}).catch(error => {
  if (typeof document !== 'undefined') document.write(`Error while signing up user: ${JSON.stringify(error)}`);
  console.error('Error while signing up user', error);
});
import com.parse.ParseException;
import com.parse.ParseUser;
import com.parse.SignUpCallback;

public void createUser() {
  ParseUser user = new ParseUser();
  user.setUsername("my name");
  user.setPassword("my pass");
  user.setEmail("[email protected]");

  // Other fields can be set just like any other ParseObject,
  // using the "put" method, like this: user.put("attribute", "its value");
  // If this field does not exists, it will be automatically created

  user.signUpInBackground(new SignUpCallback() {
    public void done(ParseException e) {
      if (e == null) {
        // Hooray! Let them use the app now.
      } else {
        // Sign up didn't succeed. Look at the ParseException
        // to figure out what went wrong
      }
    }
  });
}

func createUser() {
  var user = PFUser()
  user.username = "myUsername"
  user.password = "myPassword"
  user.email = "[email protected]"

  // Other fields can be set just like any other PFObject,
  // like this: user["attribute"] = "its value"
  // If this field does not exists, it will be automatically created

  user.signUpInBackgroundWithBlock {
    (succeeded: Bool, error: NSError?) -> Void in
    if let error = error {
      let errorString = error.userInfo["error"] as? NSString
      // Show the errorString somewhere and let the user try again.
    } else {
      // Hooray! Let them use the app now.
    }
  }
}
PFUser *user = [PFUser user];
user.username = @"my name";
user.password = @"my pass";
user.email = @"[email protected]";

// Other fields can be set just like any other PFObject,
// like this: user[@"attribute"] = @"its value";
// If this field does not exists, it will be automatically created

[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (!error) {
    // Hooray! Let them use the app now.
  } else {
    // Show the errorString somewhere and let the user try again.
    NSString *errorString = [error userInfo][@"error"];
  }
}];
public async void SignUpButton_Click(object sender, RoutedEventArgs e)
{
    var user = new ParseUser()
    {
        Username = "myname",
        Password = "MyPaSs123#",
        Email = "[email protected]"
    };

    // Other fields can be set just like any other PFObject,
    // like this: user["attribute"] = "its value"
    // If this field does not exists, it will be automatically created

    await user.SignUpAsync();
}
$user = new ParseUser();
$user->set("username", "my name");
$user->set("password", "my pass");
$user->set("email", "[email protected]");

// Other fields can be set just like any other ParseObject,
// like this: $user->set("attribute", "its value");
// If this field does not exists, it will be automatically created
// other fields can be set just like with ParseObject

try {
  $user->signUp();
  // Hooray! Let them use the app now.
} catch (ParseException $ex) {
  // Show the error message somewhere and let the user try again.
  echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
}

Example Output:

ParseUser { _objCount: 0, className: '_User', id: 'luo69YBMXi' }

To signing up a new user, you'll need to send a POST request to /users endpoint with your app's credentials in the headers and the object's data in the body. You can include as many key-value pairs as you want. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/users

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

X-Parse-Revocable-Session: 1

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent your object's data. It must contain a valid username and password.

Success Response

Status

201 Created

Headers

Location: https://parseapi.back4app.com/users/MyNewUserId

The Location header will contain the endpoint of the newly-created user.

Body

A JSON document with the objectId, createdAt and sessionToken fields of the newly-created user.

Error Response

Please check the Errors section.

Logging In

Example Request:

# Don't forget to set the USERNAME and PASSWORD parameters!
curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "X-Parse-Revocable-Session: 1" \
-G \
--data-urlencode 'username=<USERNAME>' \
--data-urlencode 'password=<PASSWORD>' \
https://parseapi.back4app.com/login

Example Response:

{
  "objectId":"AHRLeYvh0d",
  "username":"newUserName",
  "createdAt":"2018-11-08T13:50:56.843Z",
  "updatedAt":"2018-11-08T13:50:56.843Z",
  "sessionToken":"r:8d975a0f207fab1211752da3be0a3c81"
}

The response could contain another custom fields.

Code:

// Pass the username and password to logIn function
Parse.User.logIn("newUserName","#Password123").then((user) => {
  // Do stuff after successful login
  if (typeof document !== 'undefined') document.write(`Logged in user: ${JSON.stringify(user)}`);
  console.log('Logged in user', user);
}).catch(error => {
  if (typeof document !== 'undefined') document.write(`Error while logging in user: ${JSON.stringify(error)}`);
  console.error('Error while logging in user', error);
})

Example Output:

ParseUser { _objCount: 0, className: '_User', id: 'M2Uln6C4vk' }
import com.parse.LogInCallback;
import com.parse.ParseException;
import com.parse.ParseUser;

public void loginUser() {
  ParseUser.logInInBackground("<userName>", "<password>", new LogInCallback() {
    public void done(ParseUser user, ParseException e) {
      if (user != null) {
        // Hooray! The user is logged in.
      } else {
        // Signup failed. Look at the ParseException to see what happened.
      }
    }
  });
}
PFUser.logInWithUsernameInBackground("<userName>", password:"<password>") {
  (user: PFUser?, error: NSError?) -> Void in
  if user != nil {
    // Do stuff after successful login.
  } else {
    // The login failed. Check error to see why.
  }
}
[PFUser logInWithUsernameInBackground:@"myname" password:@"mypass"
  block:^(PFUser *user, NSError *error) {
    if (user) {
      // Do stuff after successful login.
    } else {
      // The login failed. Check error to see why.
    }
  }
];
try
{
    await ParseUser.LogInAsync("myname", "mypass");
    // Login was successful.
}
catch (Exception e)
{
    // The login failed. Check the error to see why.
}
try {
  $user = ParseUser::logIn("myname", "mypass");
  // Do stuff after successful login.
} catch (ParseException $error) {
  // The login failed. Check error to see why.
}

To log in into a user account you'll need to send a GET request to /login endpoint with your app's credentials in the headers and the username and password as URL parameters. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/login

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

X-Parse-Revocable-Session: 1

Parameters

Pass the username and password in URL parameters. It should be encoded JSON.

Success Response

Status

200 OK

Body

A JSON document with the user's fields.

Error Response

Please check the Errors section.

Verifying Email

Example Request:

# Don't forget to set the target e-mail!
curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]"}' \
https://parseapi.back4app.com/verificationEmailRequest

Example Response:

{}

Example Request:

const https = require('https');

const params = '{"email": "[email protected]"}';

const options = {
  hostname: 'https://parseapi.back4app.com',
  path: '/verificationEmailRequest',
  method: 'POST',
  headers: {
    'X-Parse-Application-Id': 'BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f',
    'X-Parse-REST-API-Key': 'swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w',
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  console.log(`STATUS: ${res.statusCode}`);
  if (typeof document !== 'undefined') document.write(`STATUS: ${res.statusCode}<br />`);
  res.setEncoding('utf8');
  res.on('data', (chunk) => {
    if (typeof document !== 'undefined') document.write(`BODY: ${chunk}<br />`);
    console.log(`BODY: ${chunk}`);
  });
  res.on('end', () => {
    if (typeof document !== 'undefined') document.write('No more data in response.<br />');
    console.log('No more data in response.');
  });
});

req.on('error', (e) => {
  if (typeof document !== 'undefined') document.write(`Problem with request: ${e.message}<br />`);
  console.error(`Problem with request: ${e.message}`);
});

// write data to request body
req.write(params);
req.end();

Example Response:

STATUS: 200
BODY: {}
No more data in response.

Enable email verification in server settings provides the app to reserve part of its experience just to users with confirmed email addresses. Email verification adds the emailVerified key to the Parse.User object. When a Parse.User’s email is set or modified, emailVerified is set to false and an email is automatically sent to user email. After the validation process, the emailVerified is set to true.

You can request a verification email to be sent by sending a POST request to /verificationEmailRequest endpoint with email in the body of the request:

Sign up

Code:

const user = new Parse.User()
user.set('username', 'A string');
user.set('email', 'A string');
user.set('confirmPassword', 'A string');
user.set('name', 'A string');
user.set('points', 'A string');
user.set('p', 1);
user.set('countryCode', 'A string');
user.set('RunCount', 1);
user.set('regionCode', 'A string');
user.set('favorites', [1, 'a string']);
user.set("password", "#Password123")

user.signUp()
  .then((user) => {
    Parse.User.logOut();
    if (typeof document !== 'undefined') document.write(`User signed up. Please verify your e-mail`);
    console.log("User signed up. Please verify your e-mail")
  })
  .catch((error) => {
    if (typeof document !== 'undefined') document.write(`Error while signing up user: ${JSON.stringify(error)}`);
    console.error('Error while signing up user', error);
  });

Example Output:

"Please verify your e-mail"
import com.parse.ParseException;
import com.parse.ParseUser;
import com.parse.SignUpCallback;

public void signInWithEmailVerification() {
  ParseUser user = new ParseUser();
  user.setUsername("my name");
  user.setPassword("my pass");
  user.setEmail("[email protected]");

  // Other fields can be set just like any other ParseObject,
  // using the "put" method, like this: user.put("attribute", "its value");
  // If this field does not exists, it will be automatically created

  user.signUpInBackground(new SignUpCallback() {
    public void done(ParseException e) {
      if (e == null) {
        // Here you should tell the user to verify the e-mail
        ParseUser.logOut();
      } else {
        // Sign up didn't succeed. Look at the ParseException
        // to figure out what went wrong
      }
    }
  });
}

func createUser() {
  var user = PFUser()
  user.username = "myUsername"
  user.password = "myPassword"
  user.email = "[email protected]"

  // Other fields can be set just like any other PFObject,
  // like this: user["attribute"] = "its value"
  // If this field does not exists, it will be automatically created

  user.signUpInBackgroundWithBlock {
    (succeeded: Bool, error: NSError?) -> Void in
    if let error = error {
      let errorString = error.userInfo["error"] as? NSString
      // Show the errorString somewhere and let the user try again.
    } else {
      // Here you should tell the user to verify the e-mail
      PFUser.logOut();
    }
  }
}
PFUser *user = [PFUser user];
user.username = @"my name";
user.password = @"my pass";
user.email = @"[email protected]";

// Other fields can be set just like any other PFObject,
// like this: user[@"attribute"] = @"its value";
// If this field does not exists, it will be automatically created

[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (!error) {
    // Here you should tell the user to verify the e-mail
    [PFUser logOut];
  } else {
    // Show the errorString somewhere and let the user try again.
    NSString *errorString = [error userInfo][@"error"];
  }
}];
public async void SignUpButton_Click(object sender, RoutedEventArgs e)
{
    var user = new ParseUser()
    {
        Username = "myname",
        Password = "MyPaSs123#",
        Email = "[email protected]"
    };

    // Other fields can be set just like any other PFObject,
    // like this: user["attribute"] = "its value"
    // If this field does not exists, it will be automatically created

    await user.SignUpAsync();

    // Here you should tell the user to verify the e-mail
    user.LogOut();
}
$user = new ParseUser();
$user->set("username", "my name");
$user->set("password", "my pass");
$user->set("email", "[email protected]");

// Other fields can be set just like any other ParseObject,
// like this: $user->set("attribute", "its value");
// If this field does not exists, it will be automatically created
// other fields can be set just like with ParseObject

try {
  $user->signUp();

  // Here you should tell the user to verify the e-mail
  ParseUser::logOut();
} catch (ParseException $ex) {
  // Show the error message somewhere and let the user try again.
  echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
}

To implement Sign Up with Email Verification, you will use the same method which you used to implement the basic user registration. But this time, instead of making an intent to the next page, you will ask the user to verify his or her email to login

Once the sign up process is completed, the user is automatically added to Parse Dashboard and its emailVerified Boolean attribute is set as true. Email verification is must as only you’ll be allowed to let your users access your app entirely.

Log in

Code:

// Pass the username and password to logIn function
Parse.User.logIn("newUserName","#Password123").then((user) => {
  if (user.get('emailVerified')) {
    if (typeof document !== 'undefined') document.write(`User logged in: ${JSON.stringify(user)}`);
    console.log('User logged in', user);
  } else {
    Parse.User.logOut();
    if (typeof document !== 'undefined') document.write("User logged in. Please verify your email first");
    console.log("User logged in. Please verify your email first");
  }
}).catch((error) => {
  if (typeof document !== 'undefined') document.write(`Error while logging in user: ${JSON.stringify(error)}`);
  console.error('Error while logging in user', error);
});

Example Output:

ParseUser { _objCount: 0, className: '_User', id: 'kzunnPFh5i' }

Finally, you may add your own code to provide feedback

import com.parse.LogInCallback;
import com.parse.ParseException;
import com.parse.ParseUser;

public void loginUserWithEmailVerification() {
  ParseUser.logInInBackground("<userName>", "<password>", new LogInCallback() {
    public void done(ParseUser user, ParseException e) {
      if (user != null) {
        Boolean emailVerified = user.getBoolean("emailVerified");
        if (emailVerified == true) {
          // Hooray! The user is logged in.
        } else {
          // User did not confirm the e-mail!!
        }
      } else {
        // Signup failed. Look at the ParseException to see what happened.
      }
    }
  });
}
PFUser.logInWithUsernameInBackground("<userName>", password:"<password>") {
  (user: PFUser?, error: NSError?) -> Void in
  if user != nil {
    if user["emailVerified"] != nil && user["emailVerified"] {
      // User logged in successfully :)
    } else {
      // User did not confirm the e-mail!!
    }
  } else {
    // The login failed. Check error to see why.
  }
}
[PFUser logInWithUsernameInBackground:@"myname" password:@"mypass"
  block:^(PFUser *user, NSError *error) {
    if (user && !user[@"emailVerified"]) {
      // User did not confirm the e-mail!!
      [PFUser logOut];
    }
  }
];
try
{
    var user await ParseUser.LogInAsync("myname", "mypass");
    if (user["emailVerified"] == true) {
        // User logged in successfully :)
    } else {
        // User did not confirm the e-mail!!
    }
}
catch (Exception e)
{
    // The login failed. Check the error to see why.
}
try {
  $user = ParseUser::logIn("myname", "mypass");

  if (!($user->get("emailVerified") == true)) {
    // User did not confirm the e-mail!!
    ParseUser::logOut();
  }
} catch (ParseException $error) {
  // The login failed. Check error to see why.
}

To implement Log In with Email Verification, you will use the same method which you used to implement the basic user registration. But this time, you will check the emailVerified boolean before granting further access to the user.

Requesting Password Reset

Example Request:

# Don't forget to set the target e-mail!
curl -X POST \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]"}' \
https://parseapi.back4app.com/requestPasswordReset

Example Response:

{}

Code:

// Pass the username and password to logIn function
Parse.User.requestPasswordReset("[email protected]").then(() => {
  // Password reset request was sent successfully
  if (typeof document !== 'undefined') document.write('Reset password email sent successfully');
  console.log('Reset password email sent successfully');
}).catch((error) => {
  if (typeof document !== 'undefined') document.write(`Error while creating request to reset user password: ${JSON.stringify(error)}`);
  console.error('Error while creating request to reset user password', error);
})

Example Output:

{}
import com.parse.ParseException;
import com.parse.ParseUser;
import com.parse.RequestPasswordResetCallback;

public void passwordReset() {
  // An e-mail will be sent with further instructions
  ParseUser.requestPasswordResetInBackground("[email protected]", new RequestPasswordResetCallback() {
    public void done(ParseException e) {
      if (e == null) {
        // An email was successfully sent with reset instructions.
      } else {
        // Something went wrong. Look at the ParseException to see what's up.
      }
    }
  });
}
// An e-mail will be sent with further instructions
PFUser.requestPasswordResetForEmailInBackground("[email protected]")
[PFUser requestPasswordResetForEmailInBackground:@"[email protected]"];
// An e-mail will be sent with further instructions
await ParseUser.RequestPasswordResetAsync("[email protected]");
ParseUser::requestVerificationEmail('[email protected]');

You can initiate password resets for users who have emails associated with their account. To do this, send a POST request to /requestPasswordReset endpoint with email in the body of the request: This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/requestPasswordReset

Method

POST

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Content-Type: application/json

Body

A JSON document with the user's email.

Success Response

Status

200 OK

Body

An empty JSON document.

Error Response

Please check the Errors section.

Retrieving Current User

Example Request:

# Don't forget to set the session token, received
# when you logged in or signed up
curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "X-Parse-Session-Token: <SESSION_TOKEN>" \
https://parseapi.back4app.com/users/me

Example Response:

{
  "username": "myuser123",
  "myCustomKeyName": "myCustomKeyValue",
  "createdAt": "2018-11-07T20:58:34.448Z",
  "updatedAt": "2018-11-07T20:58:34.448Z",
  "objectId": "g7y9tkhB7O",
  "sessionToken":"r:03a4c2d87a63a020a7d737c6fc64fd4c"
}

Code:

Parse.User.logIn("newUserName","#Password123").then((user) => {
  const currentUser = Parse.User.current();
  if (typeof document !== 'undefined') document.write(`Current logged in user: ${JSON.stringify(currentUser)}`);
  console.log('Current logged in user', currentUser);
}).catch(error => {
  if (typeof document !== 'undefined') document.write(`Error while logging in user: ${JSON.stringify(error)}`);
  console.error('Error while logging in user', error);
});

Example Output:

ParseUser { _objCount: 0, className: '_User', id: 'hEPjkt4epS' }

Please note that this functionality is disabled by default on Node.js environments (such as React Native) to discourage stateful usages on server-side configurations.

import com.parse.ParseUser;

public void getCurrentUser() {
  // After login, Parse will cache it on disk, so
  // we don't need to login every time we open this
  // application
  ParseUser currentUser = ParseUser.getCurrentUser();
  if (currentUser != null) {
    // do stuff with the user
  } else {
    // show the signup or login screen
  }
}
var currentUser = PFUser.currentUser()
if currentUser != nil {
  // Do stuff with the user
} else {
  // Show the signup or login screen
}
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
  // do stuff with the user
} else {
  // show the signup or login screen
}
if (ParseUser.CurrentUser != null)
{
    // do stuff with the user
}
else
{
    // show the signup or login screen
}
$currentUser = ParseUser::getCurrentUser();
if ($currentUser) {
  // Do stuff with the user
} else {
  // Show the signup or login page
}

To retrieve the current user, you'll need to send a GET request to users/me endpoint with your app's credentials and the session token in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/users/me

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

X-Parse-Session-Token: r:03a4c2d87a63a020a7d737c6fc64fd4c

Success Response

Status

200 OK

Body

A JSON document with all the user-provided fields, except password.

Error Response

Please check the Errors section.

Reading Users

Example Request:

# Don't forget to set the USER_OBJECT_ID parameter
curl -X GET \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
https://parseapi.back4app.com/users/<USER_OBJECT_ID>

Example Response:

{
  "username":\"A string\",
  "email":\"A string\",
  "confirmPassword":\"A string\",
  "name":\"A string\",
  "points":\"A string\",
  "p":1,
  "countryCode":\"A string\",
  "RunCount":1,
  "regionCode":\"A string\",
  "favorites":[ 1, \"a string\" ]

  "createdAt": "2018-11-07T20:58:34.448Z",
  "updatedAt": "2018-11-07T20:58:34.448Z",
  "objectId": "g7y9tkhB7O",
}

Code:

const User = new Parse.User();
const query = new Parse.Query(User);

query.get('hEPjkt4epS').then((user) => {
  if (typeof document !== 'undefined') document.write(`User found: ${JSON.stringify(user)}`);
  console.log('User found', user);
}, (error) => {
  if (typeof document !== 'undefined') document.write(`Error while fetching user: ${JSON.stringify(error)}`);
  console.error('Error while fetching user', error);
});

Example Output:

ParseUser { _objCount: 1, className: '_User', id: 'hEPjkt4epS' }
import java.util.List;

import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseQuery;
import com.parse.ParseUser;

public void findUsers() {
  ParseQuery<ParseUser> query = ParseUser.getQuery();
  query.whereEqualTo("email", "[email protected]");
  query.findInBackground(new FindCallback<ParseUser>() {
    public void done(List<ParseUser> users, ParseException e) {
      if (e == null) {
        // The query was successful, returns the users that matches
        // the criterias.
        for(ParseUser user : users) {
            System.out.println(user.getUsername());
        }
      } else {
        // Something went wrong.
      }
    }
  });
}
var query = PFUser.query()
query.whereKey("email", equalTo:"[email protected]")
var users = query.findObjects()
PFQuery *query = [PFUser query];
[query whereKey:@"email" equalTo:@"[email protected]"];
NSArray *users = [query findObjects];
var user = await ParseUser.Query
    .WhereEqualTo("Email", "[email protected]")
    .FindAsync();
$query = ParseUser::query();
$query->equalTo("email", "[email protected]");

// Finds all users with the given email
$users = $query->find();

To retrieve users is almost the same way as retrieving a generic Parse.Object, you'll need to send a GET request to its users endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/users/myCurrentUserId

Method

GET

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

Success Response

Status

200 OK

Body

A JSON document with all the user-provided fields except password.

Error Response

Please check the Errors section.

Updating Users

Example Request:

# Don't forget to set the SESSION_TOKEN and USER_OBJECT_ID parameters
curl -X PUT \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "X-Parse-Session-Token: <SESSION_TOKEN>" \
-H "Content-Type: application/json" \
-d "{ \"username\": \"A string\",\"email\": \"A string\",\"confirmPassword\": \"A string\",\"name\": \"A string\",\"points\": \"A string\",\"p\": 1,\"countryCode\": \"A string\",\"RunCount\": 1,\"regionCode\": \"A string\",\"favorites\": [ 1, \"a string\" ] }" \
https://parseapi.back4app.com/users/<USER_OBJECT_ID>

Example Response:

{
  "updatedAt": "2011-08-21T18:02:52.248Z"
}

You must provide the X-Parse-Session-Token header to authenticate.

Code:

const User = new Parse.User();
const query = new Parse.Query(User);

// Finds the user by its ID
query.get('hEPjkt4epS').then((user) => {
  // Updates the data we want
  user.set('username', 'A string');
  user.set('email', 'A string');
  user.set('confirmPassword', 'A string');
  user.set('name', 'A string');
  user.set('points', 'A string');
  user.set('p', 1);
  user.set('countryCode', 'A string');
  user.set('RunCount', 1);
  user.set('regionCode', 'A string');
  user.set('favorites', [1, 'a string']);
  // Saves the user with the updated data
  user.save().then((response) => {
    if (typeof document !== 'undefined') document.write(`Updated user: ${JSON.stringify(response)}`);
    console.log('Updated user', response);
  }).catch((error) => {
    if (typeof document !== 'undefined') document.write(`Error while updating user: ${JSON.stringify(error)}`);
    console.error('Error while updating user', error);
  });
});

Example Output:

ParseObjectSubclass { className: _User, _objCount: 0, id: 'xKue915KBG' }
import com.parse.ParseException;
import com.parse.ParseUser;
import com.parse.SaveCallback;

public void updateUser() {
  ParseUser currentUser = ParseUser.getCurrentUser();
  if (currentUser != null) {
    // Other attributes than "email" will remain unchanged!
    currentUser.put("email", "[email protected]");

    // Saves the object.
    // Notice that the SaveCallback is totally optional!
    currentUser.saveInBackground(new SaveCallback() {
      @Override
      public void done(ParseException e) {
        // Here you can handle errors, if thrown. Otherwise, "e" should be null
      }
    });
  }
}
var currentUser = PFUser.currentUser()
if currentUser != nil {
  currentUser["email"] = "[email protected]"

  currentUser.saveInBackground()
}
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
  currentUser[@"email"] = @"[email protected]";

  [currentUser saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if (succeeded) {
      // The PFUser has been saved.
    } else {
      // There was a problem, check error.description
    }
  }];
}
var user = await ParseUser.currentUser();
user.Username = "my_new_username"; // attempt to change username
await user.SaveAsync(); // This succeeds, since this user was
                        // authenticated on the device
$currentUser = ParseUser::getCurrentUser();
if ($currentUser) {
  // We can set the fields just like any other ParseObject
  $user->set("email", "[email protected]");

  // After we make our changes, we need to save it
  $user->save();
}

To update data on an user that already exists, send a PUT request to this user endpoint with your app's credentials in the headers and the query parameters in the body. Any keys you don’t specify will remain unchanged, so you can update just a subset of the object’s data. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/users/MyUserObjectId

Method

PUT

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

X-Parse-Session-Token: myCurrentSessionToken

Content-Type: application/json

Body

A JSON document with the key-value pairs that represent the user's new data.

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

a JSON object that contains a updatedAt field with the timestamp of the update.

Error Response

Please check the Errors section.

Deleting Users

Example Request:

# Don't forget to set the SESSION_TOKEN and USER_OBJECT_ID parameters
curl -X DELETE \
-H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
-H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
-H "X-Parse-Session-Token: <SESSION_TOKEN>" \
https://parseapi.back4app.com/users/<USER_OBJECT_ID>

Example Response:

{}

You must provide the X-Parse-Session-Token header to authenticate.

Code:


const User = new Parse.User();
const query = new Parse.Query(User);

// Finds the user by its ID
query.get('FD2UCUD3t0').then((user) => {
  // Invokes the "destroy" method to delete the user
  user.destroy().then((response) => {
    if (typeof document !== 'undefined') document.write(`Deleted user: ${JSON.stringify(response)}`);
    console.log('Deleted user', response);
  }, (error) => {
    if (typeof document !== 'undefined') document.write(`Error while deleting user: ${JSON.stringify(error)}`);
    console.error('Error while deleting user', error);
  })
});

Example Output:

ParseObjectSubclass { className: '_User', _objCount: 0, id: 'xKue915KBG' }
import com.parse.DeleteCallback;
import com.parse.ParseException;
import com.parse.ParseUser;

public void deleteUser() {
  // Notice that ParseUser extends ParseObject class, so we can
  // use the "remove" method in order to delete a single attribute.
  ParseUser currentUser = ParseUser.getCurrentUser();

  if (currentUser != null) {
    // Deletes the user.
    // Notice that the DeleteCallback is totally optional!
    currentUser.deleteInBackground(new DeleteCallback() {
      @Override
      public void done(ParseException e) {
        // Here you can handle errors, if thrown. Otherwise, "e" should be null
      }
    });
  }
}
// Notice that ParseUser extends ParseObject class, so we can use
// the "removeObjectForKey" method in order to delete a single attribute.
var currentUser = PFUser.currentUser()

if currentUser != nil {
  // Deletes the user.
  currentUser.deleteInBackground()
}
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
  // Deletes the user.
  [currentUser deleteInBackground];
}
var user = await ParseUser.currentUser();
await user.DeleteAsync(); // This succeeds, since this user was
                        // authenticated on the device
$currentUser = ParseUser::getCurrentUser();
if ($currentUser) {
  // Deletes the user.
  $user->destroy();
}

To delete an user send a DELETE request to this user endpoint with your app's credentials in the headers. This task can be easily accomplished just by calling the appropriated method of your preferred Parse SDK. Please check how to do it in the right panel of this documentation.

Request

URL

https://parseapi.back4app.com/users/MyCurrentObjectId

Method

DELETE

Headers

X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f

X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w

X-Parse-Session-Token: myCurrentSessionToken

Success Response

Status

200 OK

Headers

content-type: application/json;

Body

An empty JSON object.

Error Response

Please check the Errors section.

Queries

A query can be as simple as this, which finds all objects, given a class.

Code:

const MyCustomClass = Parse.Object.extend("MyCustomClass");

// Creates a new Query object to help us fetch MyCustomClass objects
const query = new Parse.Query(MyCustomClass);

// Executes the query, which returns an array of MyCustomClass
query.find().then(results => {
  if (typeof document !== 'undefined') document.write(`ParseObjects found: ${JSON.stringify(results)}`);
  console.log(`ParseObjects found: ${JSON.stringify(results)}`);
});
curl -X GET \
  -H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
  -H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
  https://parseapi.back4app.com/classes/MyCustomClass
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

import java.util.List;

public static void runQuery() {

  // Creates a new ParseQuery object to help us fetch MyCustomClass objects
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClass");

  // Fetches data synchronously
  try {
    List<ParseObject> results = query.find();
    for (ParseObject result : results) {
        System.out.println("Object found " + result.getObjectId());
    }
  } catch (ParseException e) {
    e.printStackTrace();
  }

  // Or use the the non-blocking method findInBackground method with a FindCallback
  query.findInBackground(new FindCallback<ParseObject>() {
    public void done(List<ParseObject> results, ParseException e) {
      // do some stuff with results
      if (results != null) {
        for (ParseObject result : results) {
          System.out.println("Object found asynchronously " + result.getObjectId());
        }
      } else if (e != null) {
        e.printStackTrace();
      }
    }
  });
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClass"];

NSArray* results = [query findObjects];

// or use the the non-blocking method findObjectsInBackgroundWithBlock

[query findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
  // do some stuff with results
}];
let query = PFQuery(className:"MyCustomClass")

let results = query.findObjects()

// or use the the non-blocking method findObjectsInBackground

query.findObjectsInBackground { (results: [PFObject]?, error: Error?) in
  // do some stuff with results
}

use Parse\ParseQuery;

$query = new ParseQuery("MyCustomClass");
$results = $query->find();
foreach($results as $result) {
  echo 'Object found ' . $result->getObjectId() . '<br>';
}
using Parse;

var query = from myCustomClass in ParseObject.GetQuery("MyCustomClass")
            select myCustomClass;
IEnumerable<ParseObject> results = await query.FindAsync();

// or using LINQ
var query = ParseObject.GetQuery("MyCustomClass");
IEnumerable<ParseObject> results = await query.FindAsync();

Sometimes you will find that the get method from the Parse Object is not enough to retrieve the exact data that you want. In this section, we will explore the Query capabilities, which allows us to fetch an array of objects, apply different constraints to filter our query results, or even get unique results given a specific field.

Counting Objects

Counting objects is as simple as that:

Code:

var MyCustomClass = Parse.Object.extend("MyCustomClass");
var query = new Parse.Query(MyCustomClass);

// Uses "count" instead of "find" to retrieve the number of objects
query.count().then(count => {
  if (typeof document !== 'undefined') document.write(`ParseObjects found: ${count}`);
  console.log(`ParseObjects found: ${count}`);
});

curl -X GET \
  -H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
  -H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
  -G --data-urlencode "count=1" \
  https://parseapi.back4app.com/classes/MyCustomClass
import com.parse.CountCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public static void runQuery() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("MyCustomClass");

  // Fetches count synchronously
  try {
    query.count();
  } catch (ParseException e) {
    e.printStackTrace();
  }

  // Or use the the non-blocking method countInBackground method with a CountCallback
  query.countInBackground(new CountCallback() {
    public void done(int count, ParseException e) {
      if (e == null) {
        System.out.println("Count", count + " objects found!");
      } else {
        System.out.println("Count", "Error: " + e.getMessage());
      }
    }
  });
}
PFQuery *query = [PFQuery queryWithClassName:@"MyCustomClass"];

[query countObjectsInBackgroundWithBlock:^(int count, NSError *error) {
  if (!error) {
    NSLog(@"%d objects found!", count);
  } else {
    // The request failed
  }
}];
let query = PFQuery(className:"MyCustomClass")
query.countObjectsInBackground { (count: Int32, error: Error?) in
    if let error = error {
        // The request failed
        print(error.localizedDescription)
    } else {
        print("\(count) objects found!")
    }
}
use Parse\ParseQuery;

$query = new ParseQuery("MyCustomClass");
$count = $query->count();
// The count request succeeded. Show the count
echo $count . " objects found!";
using Parse;

var query = from myCustomClass in ParseObject.GetQuery("MyCustomClass")
            select myCustomClass;
int count = await query.CountAsync();

// or using LINQ
var query = ParseObject.GetQuery("MyCustomClass");
int count = await query.CountAsync();

If you do not need to retrieve any data from the objects, but count them, we have it covered.

Distinct Results

Code:

const query = new Parse.Query("User");

// Returns unique emails
query.distinct("email").then(results => {
  if (typeof document !== 'undefined') document.write(`Unique emails: ${JSON.stringify(results)}`);
  console.log(`Unique emails: ${JSON.stringify(results)}`);
});

Example Request:

curl -X GET \
  -H "X-Parse-Application-Id: BCrUQVkk80pCdeImSXoKXL5ZCtyyEZwbN7mAb11f" \
  -H "X-Parse-Master-Key: 5AVAtvlGlG5cEeolatkFDhY5p99PzoBUvm7MBLMo" \
  -H "X-Parse-REST-API-Key: swrFFIXJlFudtF3HkZPtfybDFRTmS7sPwvGUzQ9w" \
  -G --data-urlencode 'distinct=likes' \
  https://parseapi.back4app.com/aggregate/Post
use Parse\ParseQuery;

$query = new ParseQuery('User');
// Returns unique emails
$results = $query->distinct('email');
foreach($results as $email) {
  echo 'Email ' . $email . '<br>';
}

Distinct feature is not yet available for this SDK, but you still can make use of the REST API directly.

The query results should contain only unique emails

It is also possible to fetch unique results for a specific field, like so:

Constraints

Code:

// "Post" is just an arbitrary class, replace it with your custom class
const Post = Parse.Object.extend("Post");
const query = new Parse.Query(Post);

// Finds objects whose title is equal to "Documentation"
query.equalTo("title", "Documentation");

// Finds objects whose title is not equal to "No hard feelings"
query.notEqualTo("title", "No hard feelings");

// Finds objects with less than 50 likes
query.lessThan("likes", 50);

// Finds objects with less than or equal to 50 likes
query.lessThanOrEqualTo("likes", 50);

// Finds objects with more than 50 likes
query.greaterThan("likes", 50);

// Finds objects with more than or equal to 50 likes
query.greaterThanOrEqualTo("likes", 50);

// Finds objects whose "category" field is either "it", "politics" or "sports"
query.containedIn("category", ["it", "politics", "sports"]);

// Finds objects whose "category" field is neither "music", "health" or "trending"
query.notContainedIn("category", ["music", "health", "trending"]);

// Finds objects that have the "relatedPost" field set
query.exists("relatedPost");

// Finds objects that don't have the "relatedPost" field set
query.doesNotExist("relatedPost");

// Find objects where "tags" field is an array and contains "books".
query.equalTo("tags", "books");

// Find objects where "tags" field is an array and contains all of the elements
// "fun", "recommended", and "cheap".
query.containsAll("tags", ["fun", "recommended", "cheap"]);

// Title starts with "Life"
query.startsWith("title", "Life");

// Title contains "cat"
query.fullText('title', 'cat');

query.find().then(results => {
  if (typeof document !== 'undefined') document.write(`ParseObjects found: ${JSON.stringify(results)}`);
  console.log(`ParseObjects found: ${JSON.stringify(results)}`);
});
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public static void runQuery() {
  ParseQuery<ParseObject> query = ParseQuery.getQuery("Post");

  // Finds objects whose title is equal to "Documentation"
  query.whereEqualTo("title", "Documentation");

  // Finds objects whose title is not equal to "No hard feelings"
  query.whereNotEqualTo("title", "No hard feelings");

  // Finds objects with less than 50 likes
  query.whereLessThan("likes", 50);

  // Finds objects with less than or equal to 50 likes
  query.whereLessThanOrEqualTo("likes", 50);

  // Finds objects with more than 50 likes
  query.whereGreaterThan("likes", 50);

  // Finds objects with more than or equal to 50 likes
  query.whereGreaterThanOrEqualTo("likes", 50);

  // Finds objects whose "category" field is either "it", "politics" or "sports"
  query.whereContainedIn("category", Arrays.asList("it", "politics", "sports"));

  // Finds objects whose "category" field is neither "music", "health" or "trending"
  query.whereNotContainedIn("category", Arrays.asList("music", "health", "trending"));

  // Finds objects that have the "relatedPost" field set
  query.whereExists("relatedPost");

  // Finds objects that don't have the "relatedPost" field set
  query.whereDoesNotExist("relatedPost");

  // Find objects where "tags" field is an array and contains "books".
  query.whereEqualTo("tags", "books");

  // Find objects where "tags" field is an array and contains all of the elements
  // "fun", "recommended", and "cheap".
  List<String> myTags = new ArrayList<String>();
  myTags.add("fun");
  myTags.add("recommended");
  myTags.add("cheap");
  query.whereContainsAll("tags", myTags);

  // Title starts with "Life"
  query.whereStartsWith("title", "Life");

  // Title contains "cat"
  query.whereFullText("title", "cat");

  try {
    List<ParseObject> results = query.find();
    for (ParseObject result : results) {
      System.out.println("Object found " + result.getObjectId());
    }
  } catch (ParseException e) {
    e.printStackTrace();
  }
}
// "Post" is just an arbitrary class, replace it with your custom class
PFQuery *query = [PFQuery queryWithClassName:@"Post"];

// Finds objects whose title is equal to "Documentation"
[query whereKey:@"title" equalTo:@"Documentation"];

// Finds objects whose title is not equal to "No hard feelings"
[query whereKey:@"title" equalTo:@"No hard feelings"];

// Finds objects with less than 50 likes
[query whereKey:@"likes" lessThan:@50];

// Finds objects with less than or equal to 50 likes
[query whereKey:@"likes" lessThanOrEqualTo:@50];

// Finds objects with more than 50 likes
[query whereKey:@"likes" greaterThan:@50];

// Finds objects with more than or equal to 50 likes
[query whereKey:@"likes" greaterThanOrEqualTo:@50];

// Finds objects whose "category" field is either "it", "politics" or "sports"
[query whereKey:@"category" containedIn:@[@"it", @"politics", @"sports"]];

// Finds objects whose "category" field is neither "music", "health" or "trending"
[query whereKey:@"category" containedIn:@[@"music", @"health", @"trending"]];

// Finds objects that have the "relatedPost" field set
[query whereKeyExists:@"relatedPost"];

// Finds objects that don't have the "relatedPost" field set
[query doesNotExist:@"relatedPost"];

// Find objects where "tags" field is an array and contains "books".
[query whereKey:@"tags" equalTo:@"books"];

// Find objects where "tags" field is an array and contains all of the elements
// "fun", "recommended", and "cheap".
[query whereKey:@"tags" containsAllObjectsInArray:@[@"fun", @"recommended", @"cheap"]];

// Title starts with "Life"
[query whereKey:@"title" hasPrefix:@"Life"];

// Title contains "cat"
[query whereKey:@"title" matchesText:@"cat"];

NSArray* results = [query findObjects];
// "Post" is just an arbitrary class, replace it with your custom class
let query = PFQuery(className:"Post")

// Finds objects whose title is equal to "Documentation"
query.whereKey("title", equalTo: "Documentation");

// Finds objects whose title is not equal to "No hard feelings"
query.whereKey("title", notEqualTo: "No hard feelings");

// Finds objects with less than 50 likes
query.whereKey("likes", lessThan: 50);

// Finds objects with less than or equal to 50 likes
query.whereKey("likes", lessThanOrEqualTo: 50);

// Finds objects with more than 50 likes
query.whereKey("likes", greaterThan: 50);

// Finds objects with more than or equal to 50 likes
query.whereKey("likes", greaterThanOrEqualTo: 50);

// Finds objects whose "category" field is either "it", "politics" or "sports"
query.whereKey("category", containedIn: ["it", "politics", "sports"]);

// Finds objects whose "category" field is neither "music", "health" or "trending"
query.whereKey("category", notContainedIn: ["music", "health", "trending"]);

// Finds objects that have the "relatedPost" field set
query.whereKeyExists("relatedPost");

// Finds objects that don't have the "relatedPost" field set
query.whereKeyDoesNotExist("relatedPost");

// Find objects where "tags" field is an array and contains "books".
query.whereKey("tags", equalTo: "books");

// Find objects where "tags" field is an array and contains all of the elements
// "fun", "recommended", and "cheap".
query.whereKey("tags", containsAllObjectsIn: ["fun", "recommended", "cheap"]);

// Title starts with "Life"
query.whereKey("title", hasPrefix: "Life");

// Title contains "cat"
query.whereKey('title', matchesText: 'cat');

let results = query.findObjects()
use Parse\ParseQuery;

$query = new ParseQuery('Post');

// Finds objects whose title is equal to "Documentation"
$query->equalTo("title", "Documentation");

// Finds objects whose title is not equal to "No hard feelings"
$query->notEqualTo("title", "No hard feelings");

// Finds objects with less than 50 likes
$query->lessThan("likes", 50);

// Finds objects with less than or equal to 50 likes
$query->lessThanOrEqualTo("likes", 50);

// Finds objects with more than 50 likes
$query->greaterThan("likes", 50);

// Finds objects with more than or equal to 50 likes
$query->greaterThanOrEqualTo("likes", 50);

// Finds objects whose "category" field is either "it", "politics" or "sports"
$query->containedIn("category", ["it", "politics", "sports"]);

// Finds objects whose "category" field is neither "music", "health" or "trending"
$query->notContainedIn("category", ["music", "health", "trending"]);

// Finds objects that have the "relatedPost" field set
$query->exists("relatedPost");

// Finds objects that don't have the "relatedPost" field set
$query->doesNotExist("relatedPost");

// Find objects where "tags" field is an array and contains "books".
$query->equalTo("tags", "books");

// Find objects where "tags" field is an array and contains all of the elements
// "fun", "recommended", and "cheap".
$query->containsAll("tags", ["fun", "recommended", "cheap"]);

// Title starts with "Life"
$query->startsWith("name", "Life");

// Title contains "cat"
$query->fullText('title', 'cat');

$results = $query->find();
foreach($results as $result) {
  echo 'Object found ' . $result->getObjectId() . '<br>';
}
using Parse;

// "Post" is just an arbitrary class, replace it with your custom class
var query = from post in ParseObject.GetQuery("Post")
            // Finds objects whose title is equal to "Documentation"
            where post.Get<string>("title") == "Documentation"

            // Finds objects whose title is not equal to "No hard feelings"
            where post.Get<string>("title") != "No hard feelings"

            // Finds objects with less than 50 likes
            where post.Get<int>("likes") < 50

            // Finds objects with less than or equal to 50 likes
            where post.Get<int>("likes") <= 50

            // Finds objects with more than 50 likes
            where post.Get<int>("likes") > 50

            // Finds objects with more than or equal to 50 likes
            where post.Get<int>("likes") >= 50

            // Finds objects whose "category" field is either "it", "politics" or "sports"
            where (new[] {"it", "politics", "sports"}).Contains(post.Get<string>("category"))

            // Finds objects whose "category" field is neither "music", "health" or "trending"
            where (new[] {"music", "health", "trending"}).Contains(post.Get<string>("category"))

            // Finds objects that have the "relatedPost" field set
            where post.ContainsKey("relatedPost")

            // Finds objects that don't have the "relatedPost" field set
            where !post.ContainsKey("relatedPost")

            // Find objects where "tags" field is an array and contains "books".
            where post.Get<IList<string>>("tags").Contains("books")

            // Title starts with "Life"
            where post.Get<string>("title").StartsWith("Life")

            select post;

// or using LINQ
// "Post" is just an arbitrary class, replace it with your custom class
var query = ParseObject.GetQuery("Post")
    // Finds objects whose title is equal to "Documentation"
    .WhereEqualTo("title", "Documentation")

    // Finds objects whose title is not equal to "No hard feelings"
    .WhereNotEqualTo("title", "No hard feelings")

    // Finds objects with less than 50 likes
    .WhereLessThan("likes", 50)

    // Finds objects with less than or equal to 50 likes
    .WhereLessThanOrEqualTo("likes", 50)

    // Finds objects with more than 50 likes
    .WhereGreaterThan("likes", 50)

    // Finds objects with more than or equal to 50 likes
    .WhereGreaterThanOrEqualTo("likes", 50)

    // Finds objects whose "category" field is either "it", "politics" or "sports"
    .WhereContainedIn("category", (new[] {"it", "politics", "sports"}))

    // Finds objects whose "category" field is neither "music", "health" or "trending"
    .WhereNotContainedIn("ca