Attributes

Attribute

type

values

default

mandate

comment

data

binary

 

 

true

Base64 encoded

thumbnail

binary

 

 

false

Base64 encoded

Format

string

 

 

true

 

description

string

 

 

false

 

user

object

 

null

false

 

repository

object

 

 

true

 


/image /create

Examples:

  1. create a system image

Method:/image /create
Parameters:
{
"attrs":
[
"repository.id":"repoid"
"data":data,// in base64?
"format":"jpg",
"description":zzz
]
}
Response:
{
"error":0,
"result":{"id":1}
}

  1. create an user image

Method:/image /create
Parameters:
{
"attrs":
[
"repository.id":"repoid"
"data":data,
"format":"jpg",
"description":zzz,
"user.id":userId
]
}
Response:
{
"error":0,
"result":{"id":1}
}

/image /get

Method:/image /get
Parameters:
{
"match":
[
["id", "=", 2]
],
"return":["*"],
}
Response:
{
"error":0,
"result":
{
"data":data,
"format":"jpg",
"description":"zzz"
}
}

/image /set

Method:/image /set
Parameters:
{
"id":1,
"attrs":{"description":"xyz"}
}
Response:
{
"error":0
}

/image /delete

Method:/image /delete
Parameters:
{
"id":1
}
Response:
{
"error":0
}

/image /search

  1. search all system images

Method:/image /search
Parameters:
{
"match":
[
"user.id", "=", null
],
"return":["data", "id"],
}
Response:
{
"error":0,
"result":
{
total:2,
rows:
[
{
"data":"xxx",
"id":1234,
},
{
"data":"xxx",
"id":"1235",
}
]
}
}

  1. Search user's image

Method:/image /search
Parameters:
{
"match":
[
"user.id", "=", userId
],
"return":["data", "id"],
}
Response:
{
"error":0,
"result":
{
total:2,
rows:
[
{
"data":data,
"id":1234,
},
{
"data":data,
"id":"1235",
}
]
}
}

  • No labels