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
}
{
"errors": [
"You don't have appropriate permissions to do this operation"
]
}
{
"name": [
"can't be blank",
"must contain only alphanumeric or underscore characters and begin with a letter.",
"is too short (minimum is 3 characters)",
"is too long (maximum is 50 characters)"
]
}
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
}
{
"errors": [
"You don't have appropriate permissions to do this operation"
]
}
{
"name": [
"can't be blank",
"must contain only alphanumeric or underscore characters and begin with a letter.",
"is too short (minimum is 3 characters)",
"is too long (maximum is 50 characters)"
]
}
Recipes
Create class
Create class
1. Set a name of the classs
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
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
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
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
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
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
}
Create class with API key
Create class with API key
1. Use 'Authorization' header to pass API key
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
"name":"UserCustomProfile",
}' \
"https://api.quickblox.com/class.json"
2. Set a name of the classs
name parameter to set the name of the class.curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
"name":"UserCustomProfile",
}' \
"https://api.quickblox.com/class.json"
3. Use a `fields` parameter to set custom fields
fields stores a set of unique keys each having an associated value parameter.curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
"name":"UserCustomProfile",
"fields":{},
}' \
"https://api.quickblox.com/class.json"
4. Set fields of the custom class
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
}' \
"https://api.quickblox.com/class.json"
5. Use a `permissions` parameter to set operations allowed and access levels
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{},
}' \
"https://api.quickblox.com/class.json"
6. Set CRUD operations
create, read, and update operations are set.curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
"name":"UserCustomProfile",
"fields":{
"name":"String",
"last_name":"String",
"age":"Integer",
"tags":"String_a"
},
"permissions":{
"create":{},
"read":{},
"update":{},
},
}' \
"https://api.quickblox.com/class.json"
7. Set access levels
open, not_allowed, and open_for_users_ids access levels are set.curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-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"
8. Set IDs of users
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-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"
9. 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
}
| Permission | Syntax | Example |
|---|---|---|
| Open | permissions.<CRUD_operation>.access | permissions.read.access=open |
| Owner | permissions.<CRUD_operation>.access | permissions.read.access=owner |
| Not allowed | permissions.<CRUD_operation>.access | permissions.read.access=not_allowed |
| Open for users IDs | permissions.<CRUD_operation>.access=open_for_users_ids permissions.<CRUD_operation>.ids=id_1,id_2,id_3,… | permissions.update.access=open_for_users_ids permissions.update.ids=3,12 |
| Open for groups | permissions.<CRUD_operation>.access=open_for_groups permissions.<CRUD_operation>.groups=group_name_1,group_name_2 | permissions.delete.access=open_for_groups permissions.delete.groups=experience,rate |
Body Parameters
fields.{custom_field}=<field_type>.Show fields object
Show fields object
Integer, Float, String, Boolean, File, Date,
Location (array of [longitude, latitude]).Possible array types: Integer_a, Float_a, Boolean_a, String_a.permission.<CRUD_operation>.access=<value> permission.<CRUD_operation>.<option>=<value>CRUD operations: create, read, update, delete. CRUD access values:
open, owner, not_allowed, open_for_users_ids, open_for_groups. CRUD options:
ids, groups.Headers
ApiKey {your_api_key}. Must be used
either QB-Token or Authorization.Responses
201
201
403
403
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
}
{
"errors": [
"You don't have appropriate permissions to do this operation"
]
}
{
"name": [
"can't be blank",
"must contain only alphanumeric or underscore characters and begin with a letter.",
"is too short (minimum is 3 characters)",
"is too long (maximum is 50 characters)"
]
}
Was this page helpful?