How can I limit the fields displayed in the API response for assets?
fetch('/api/collections/get/posts?token=xxtokenxx', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
filter: {published:true},
fields: {
fieldA: 1, //what if this field is an asset field?
//How can i specify the returned fields?
//I tried this with no success
fieldA: {
fields:{fieldA1:1, fieldA2:0}
},
fieldB: 1
},
limit: 10
})
})
this is what the API returns for asset field:
"FieldA":{
"path":"..\/..",
"title":"ext-1.jpeg",
"mime":"image\/jpeg",
"description":"",
"tags":[],
"size":22890,
"image":true,
"video":false,
"audio":false,
"archive":false,
"document":false,
"code":false,
"created":1562254299,
"modified":1562254299,
"_by":"43657768878999",
"width":573,
"height":308,
"colors":[
"#cfbfae",
"#0b0b0b",
"#6b5d4e",
"#848481",
"#586e90"
],
"folder":"",
"_id":"5d1e1bdb33663653247643"
}
and I only need an API response like this:
"FieldA":{
"path":"..\/..",
"title":"ext-1.jpeg",
"_id":"5d1e1bdb33663653247643"
}