REST API
- Overview
- Limits
- Errors
- GETGet Account Settings
- Authentication
- Users
- Chat
- Content
- Push Notifications
- Custom Objects
- Overview
- Dashboard
- Relations
- Permissions
- Class Model
- POSTCreate Class
- Record Model
- POSTCreate Record
- POSTCreate Child Record
- POSTCreate Multi Records
- GETList Records
- GETList Records by IDs
- PUTUpdate Record
- PUTUpdate Records by Criteria
- PUTUpdate Multi Records
- DELDelete Records
- DELDelete Records by Criteria
- File Model
- POSTUpload/Update File
- GETDownload File
- DELDelete File
- Tips and Tricks
- Address Book
- AI
Create Class
Create a class to define any data structure you need. The class can be created by the account owner only.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{
"create":{
"access":"open"
},
"read":{
"access":"not_allowed"
},
"update":{
"access":"open_for_users_ids",
"ids":"1,2"
}
}
}' \
https://api.quickblox.com/class.json
{
"_id": "5ddfb849a0eb4725dfc9b0ad",
"acl": {
"read": {
"access": "not_allowed"
},
"update": {
"access": "open_for_users_ids",
"users_ids": [
"1",
"2"
]
},
"delete": {
"access": "owner"
},
"create": {
"access": "open",
"primary": true
}
},
"application_id": 78387,
"custom_fields": [
{
"name": "name",
"type": "String"
},
{
"name": "last_name",
"type": "String"
},
{
"name": "age",
"type": "Integer"
},
{
"is_array": "1",
"name": "tags",
"type": "String"
}
],
"name": "UserCustomProfile",
"user_id": 91103344
}
Recipes
1. Set a name of the classs
Use a name
parameter to set the name of the class.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
}' \
"https://api.quickblox.com/class.json"
2. Use a `fields` parameter to set custom fields
The fields
stores a set of unique keys each having an associated value parameter.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{},
}' \
"https://api.quickblox.com/class.json"
3. Set fields of the custom class
Set as many fields for a new class as you need.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
}' \
"https://api.quickblox.com/class.json"
4. Use a `permissions` parameter to set operations allowed and access levels
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{},
}' \
"https://api.quickblox.com/class.json"
5. Set CRUD operations
Set the operations that can be performed on a record.
Here, the create
, read
, and update
operations are set.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{
"create":{},
"read":{},
"update":{},
},
}' \
"https://api.quickblox.com/class.json"
6. Set access levels
Set an access level for a record.
Here, the open
, not_allowed
, and open_for_users_ids
access levels are set.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{
"create":{
"access":"open"
},
"read":{
"access":"not_allowed"
},
"update":{
"access":"open_for_users_ids"
},
},
}' \
"https://api.quickblox.com/class.json"
7. Set IDs of users
Set IDs of users who can make a required operation.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{
"create":{
"access":"open"
},
"read":{
"access":"not_allowed"
},
"update":{
"access":"open_for_users_ids",
"ids":"1,2"
},
},
}' \
"https://api.quickblox.com/class.json"
8. As a result, the API returns a newly created class.
{
"_id": "5ddfb849a0eb4725dfc9b0ad",
"acl": {
"read": {
"access": "not_allowed"
},
"update": {
"access": "open_for_users_ids",
"users_ids": [
"1",
"2"
]
},
"delete": {
"access": "owner"
},
"create": {
"access": "open",
"primary": true
}
},
"application_id": 78387,
"custom_fields": [
{
"name": "name",
"type": "String"
},
{
"name": "last_name",
"type": "String"
},
{
"name": "age",
"type": "Integer"
},
{
"is_array": "1",
"name": "tags",
"type": "String"
}
],
"name": "UserCustomProfile",
"user_id": 91103344
}
Body Parameters
Custom class fields with types.
Format: fields.{custom_field}=<field_type>
.
Name and type of a custom field. Can be many 1..N.
Possible plain types: Integer
, Float
, String
, Boolean
, File
, Date
,
Location
(array of [longitude, latitude]).
Possible array types: Integer_a
, Float_a
, Boolean_a
, String_a
.
Headers
Responses
A successful response
The ID of the associated application
Name of the resource
The ID of the associated user
An error response
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{
"create":{
"access":"open"
},
"read":{
"access":"not_allowed"
},
"update":{
"access":"open_for_users_ids",
"ids":"1,2"
}
}
}' \
https://api.quickblox.com/class.json
{
"_id": "5ddfb849a0eb4725dfc9b0ad",
"acl": {
"read": {
"access": "not_allowed"
},
"update": {
"access": "open_for_users_ids",
"users_ids": [
"1",
"2"
]
},
"delete": {
"access": "owner"
},
"create": {
"access": "open",
"primary": true
}
},
"application_id": 78387,
"custom_fields": [
{
"name": "name",
"type": "String"
},
{
"name": "last_name",
"type": "String"
},
{
"name": "age",
"type": "Integer"
},
{
"is_array": "1",
"name": "tags",
"type": "String"
}
],
"name": "UserCustomProfile",
"user_id": 91103344
}
Was this page helpful?
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: c95dbdc9c72cc8e7f2367d7ef2c6d99c5e013233" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{
"create":{
"access":"open"
},
"read":{
"access":"not_allowed"
},
"update":{
"access":"open_for_users_ids",
"ids":"1,2"
}
}
}' \
https://api.quickblox.com/class.json
{
"_id": "5ddfb849a0eb4725dfc9b0ad",
"acl": {
"read": {
"access": "not_allowed"
},
"update": {
"access": "open_for_users_ids",
"users_ids": [
"1",
"2"
]
},
"delete": {
"access": "owner"
},
"create": {
"access": "open",
"primary": true
}
},
"application_id": 78387,
"custom_fields": [
{
"name": "name",
"type": "String"
},
{
"name": "last_name",
"type": "String"
},
{
"name": "age",
"type": "Integer"
},
{
"is_array": "1",
"name": "tags",
"type": "String"
}
],
"name": "UserCustomProfile",
"user_id": 91103344
}