curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 199b1d9ec0dedeb19d81283b3b2a32b80f012bba" \
-d '{
"record":{
"0":{
"score_value":3021,
"progress":"0.42",
"expert_mode":false,
"game_mode_name":"4x4",
"date":"2019-09-21 21:25:00",
"completed_levels":[
1,
2,
3,
4,
5,
6
]
},
"1":{
"score_value":1211,
"progress":"0.32",
"expert_mode":true,
"game_mode_name":"deathmatch",
"user_location":"21.23, 15.32",
"date":"2019-09-20 15:21:00",
"completed_levels":[
1,
2,
3,
4,
5
]
}
}
}' \
"https://api.quickblox.com/data/ScoreTable/multi.json"
{
"class_name": "ScoreTable",
"items": [
{
"_id": "5d867291a0eb473ed96099c4",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5,
6
],
"created_at": 1569092241,
"date": "2019-09-21T21:25:00Z",
"expert_mode": false,
"game_mode_name": "4x4",
"progress": 0.42,
"score_value": 3021,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": null,
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
},
{
"_id": "5d867291a0eb473ed96099c5",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5
],
"created_at": 1569092241,
"date": "2019-09-20T15:21:00Z",
"expert_mode": true,
"game_mode_name": "deathmatch",
"progress": 0.32,
"score_value": 1211,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
21.23,
15.32
],
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
}
]
}
{
"errors": [
"You don't have appropriate permissions to do this operation"
]
}
Custom Objects
Create Multi Records
Create multiple records.
POST
/
data
/
{class_name}
/
multi.json
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 199b1d9ec0dedeb19d81283b3b2a32b80f012bba" \
-d '{
"record":{
"0":{
"score_value":3021,
"progress":"0.42",
"expert_mode":false,
"game_mode_name":"4x4",
"date":"2019-09-21 21:25:00",
"completed_levels":[
1,
2,
3,
4,
5,
6
]
},
"1":{
"score_value":1211,
"progress":"0.32",
"expert_mode":true,
"game_mode_name":"deathmatch",
"user_location":"21.23, 15.32",
"date":"2019-09-20 15:21:00",
"completed_levels":[
1,
2,
3,
4,
5
]
}
}
}' \
"https://api.quickblox.com/data/ScoreTable/multi.json"
{
"class_name": "ScoreTable",
"items": [
{
"_id": "5d867291a0eb473ed96099c4",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5,
6
],
"created_at": 1569092241,
"date": "2019-09-21T21:25:00Z",
"expert_mode": false,
"game_mode_name": "4x4",
"progress": 0.42,
"score_value": 3021,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": null,
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
},
{
"_id": "5d867291a0eb473ed96099c5",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5
],
"created_at": 1569092241,
"date": "2019-09-20T15:21:00Z",
"expert_mode": true,
"game_mode_name": "deathmatch",
"progress": 0.32,
"score_value": 1211,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
21.23,
15.32
],
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
}
]
}
{
"errors": [
"You don't have appropriate permissions to do this operation"
]
}
Recipes
Create multiple records with API key
Create multiple records with API key
1
1. Use 'Authorization' header to pass API key
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
"record":{
"0":{
"score_value":3021,
"progress":"0.42",
"expert_mode":false,
"game_mode_name":"4x4",
"date":"2019-09-21 21:25:00",
"completed_levels":[
1,
2,
3,
4,
5,
6
]
},
"1":{
"score_value":1211,
"progress":"0.32",
"expert_mode":true,
"game_mode_name":"deathmatch",
"user_location":"21.23, 15.32",
"date":"2019-09-20 15:21:00",
"completed_levels":[
1,
2,
3,
4,
5
]
}
}
}' \
"https://api.quickblox.com/data/ScoreTable/multi.json"
2
2. As a result, the API returns the newly created records.
{
"class_name": "ScoreTable",
"items": [
{
"_id": "5d867291a0eb473ed96099c4",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5,
6
],
"created_at": 1569092241,
"date": "2019-09-21T21:25:00Z",
"expert_mode": false,
"game_mode_name": "4x4",
"progress": 0.42,
"score_value": 3021,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": null,
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
},
{
"_id": "5d867291a0eb473ed96099c5",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5
],
"created_at": 1569092241,
"date": "2019-09-20T15:21:00Z",
"expert_mode": true,
"game_mode_name": "deathmatch",
"progress": 0.32,
"score_value": 1211,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
21.23,
15.32
],
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
}
]
}
| Permission | Syntax | Example |
|---|---|---|
| Open | permissions.<CRUD_operation>.access | permissions.read.access=open |
| Owner | permissions.<CRUD_operation>.access | permissions.read.access=owner |
| 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 |
Path Parameters
string
required
A class name of the parent custom object.
Body Parameters
object
Show properties
Show properties
object
A number of the record in the query. Begin with 1 to N, where N is the number of the last record.
Show properties
Show properties
string
Set value to the field defined in Custom Object class. Can be many 1..N.
string
Record permissions. Format:
CRUD access values:
CRUD options:
permission.<CRUD_operation>.access=<value> permission.<CRUD_operation>.<option>=<value>CRUD operations: create, read, update, delete. CRUD access values:
open, owner, open_for_users_ids, open_for_groups. CRUD options:
ids, groups.Headers
string
required
A user or application session token. See Authentication page to learn more about session tokens. Must be used either QB-Token or Authorization.
string
default:"ApiKey {your_api_key}"
API key from Dashboard. Expected format:
ApiKey {your_api_key}. Must be used
either QB-Token or Authorization.string
User ID. The user ID of the user on whose behalf the request is being made.
Responses
201
201
403
403
An error response
array of strings
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 199b1d9ec0dedeb19d81283b3b2a32b80f012bba" \
-d '{
"record":{
"0":{
"score_value":3021,
"progress":"0.42",
"expert_mode":false,
"game_mode_name":"4x4",
"date":"2019-09-21 21:25:00",
"completed_levels":[
1,
2,
3,
4,
5,
6
]
},
"1":{
"score_value":1211,
"progress":"0.32",
"expert_mode":true,
"game_mode_name":"deathmatch",
"user_location":"21.23, 15.32",
"date":"2019-09-20 15:21:00",
"completed_levels":[
1,
2,
3,
4,
5
]
}
}
}' \
"https://api.quickblox.com/data/ScoreTable/multi.json"
{
"class_name": "ScoreTable",
"items": [
{
"_id": "5d867291a0eb473ed96099c4",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5,
6
],
"created_at": 1569092241,
"date": "2019-09-21T21:25:00Z",
"expert_mode": false,
"game_mode_name": "4x4",
"progress": 0.42,
"score_value": 3021,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": null,
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
},
{
"_id": "5d867291a0eb473ed96099c5",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
4,
5
],
"created_at": 1569092241,
"date": "2019-09-20T15:21:00Z",
"expert_mode": true,
"game_mode_name": "deathmatch",
"progress": 0.32,
"score_value": 1211,
"updated_at": 1569092241,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
21.23,
15.32
],
"permissions": {
"read": {
"access": "open"
},
"update": {
"access": "owner"
},
"delete": {
"access": "owner"
}
}
}
]
}
{
"errors": [
"You don't have appropriate permissions to do this operation"
]
}
Was this page helpful?
⌘I