Query strutturata
POST /api/resources/{Resource}/query
| Voce | Valore |
|---|---|
| Descrizione | Ricerca con filtri e ordinamento nel corpo della richiesta |
| Autenticazione | Bearer |
| Query string | PageSize, PageNumber |
| Corpo | Array con un oggetto filtri/ordinamenti |
| Natura | Sola lettura |
Corpo
[
{
"ResourcesViewsFilters": [
{ "FieldName": "<CAMPO>", "Operator": "contains", "Value": "<VALORE>" }
],
"ResourcesViewsSortFields": [
{ "FieldName": "<CAMPO>", "Direction": "asc" }
]
}
]
| Proprietà | Descrizione |
|---|---|
FieldName | Nome del campo della risorsa |
Operator | Operatore di confronto; contains cerca la sottostringa |
Value | Valore, come stringa |
Direction | Verso dell'ordinamento: asc |
Esempio: ricerca di clienti per ragione sociale
- curl
- C#
- JavaScript
curl -X POST "<BASE_URL>/api/resources/MCPClienti/query?PageSize=100&PageNumber=1" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json; charset=utf-8" \
-d '[{"ResourcesViewsFilters":[{"FieldName":"des_ragsoc","Operator":"contains","Value":"<VALORE>"}],"ResourcesViewsSortFields":[{"FieldName":"des_ragsoc","Direction":"asc"}]}]'
var body = new[] {
new {
ResourcesViewsFilters = new object[] {
new { FieldName = "des_ragsoc", Operator = "contains", Value = "<VALORE>" }
},
ResourcesViewsSortFields = new object[] {
new { FieldName = "des_ragsoc", Direction = "asc" }
}
}
};
using var resp = await http.PostAsJsonAsync("api/resources/MCPClienti/query?PageSize=100&PageNumber=1", body);
resp.EnsureSuccessStatusCode();
const body = [{
ResourcesViewsFilters: [{ FieldName: "des_ragsoc", Operator: "contains", Value: "<VALORE>" }],
ResourcesViewsSortFields: [{ FieldName: "des_ragsoc", Direction: "asc" }],
}];
const resp = await fetch(`${BASE_URL}/api/resources/MCPClienti/query?PageSize=100&PageNumber=1`, {
method: "POST",
headers: { ...headers, "Content-Type": "application/json; charset=utf-8" },
body: JSON.stringify(body),
});