$catalog
The catalog describes all the dataclasses, attributes, and interprocess (shared) singletons available in the project.
Syntaxe
Syntaxe | Exemple | Description |
---|---|---|
$catalog | /$catalog | Returns shared singletons (if any) and a list of the dataclasses in your project along with two URIs |
$catalog/$all | /$catalog/$all | Returns shared singletons (if any) and information about all of your project's dataclasses and their attributes |
$catalog/{dataClass} | /$catalog/Employee | Renvoie des informations sur une dataclass et ses attributs |
$catalog/DataStoreClassFunction | /$catalog/authentify | Exécute la fonction de datastore class authentify() si elle existe |
$catalog
Returns shared singletons (if any) and a list of the dataclasses in your project along with two URIs: one to access the information about its structure and one to retrieve the data in the dataclass
Description
Lorsque vous appelez $catalog
, une liste des dataclass est retournée avec deux URI pour chaque dataclass dans le datastore de votre projet.
Seules les dataclass exposées apparaissent dans cette liste pour le datastore de votre projet. Pour plus d'informations, veuillez vous reporter à la section Exposer les tables et les champs.
Voici une description des propriétés retournées pour chaque dataclass dans le datastore de votre projet :
Propriété | Type | Description |
---|---|---|
name | String | Nom de la dataclass. |
uri | String | Un URI vous permettant d'obtenir des informations sur la dataclass et ses attributs. |
dataURI | String | URI vous permettant d'afficher les données dans la dataclass. |
Exemple
GET /rest/$catalog
Résultat :
{
dataClasses: [
{
name: "Company",
uri: "http://127.0.0.1:8081/rest/$catalog/Company",
dataURI: "http://127.0.0.1:8081/rest/Company"
},
{
name: "Employee",
uri: "http://127.0.0.1:8081/rest/$catalog/Employee",
dataURI: "http://127.0.0.1:8081/rest/Employee"
}
]
}
$catalog/$all
Returns shared singletons (if any) and information about all of your project's dataclasses and their attributes
Description
En appelant $catalog/$all
, vous pouvez recevoir des informations détaillées sur les attributs de chacune des dataclasses du modèle de votre projet.
For more information about what is returned for each dataclass and its attributes, use $catalog/\{dataClass\}
.
Exemple
GET /rest/$catalog/$all
Résultat :
{
"dataClasses": [
{
"name": "Company",
"className": "Company",
"collectionName": "CompanySelection",
"tableNumber": 2,
"scope": "public",
"dataURI": "/rest/Company",
"attributes": [
{
"name": "ID",
"kind": "storage",
"fieldPos": 1,
"scope": "public",
"indexed": true,
"type": "long",
"identifying": true
},
{
"name": "name",
"kind": "storage",
"fieldPos": 2,
"scope": "public",
"type": "string"
},
{
"name": "revenues",
"kind": "storage",
"fieldPos": 3,
"scope": "public",
"type": "number"
},
{
"name": "staff",
"kind": "relatedEntities",
"fieldPos": 4,
"scope": "public",
"type": "EmployeeSelection",
"reversePath": true,
"path": "employer"
},
{
"name": "url",
"kind": "storage",
"scope": "public",
"type": "string"
}
],
"key": [
{
"name": "ID"
}
]
},
{
"name": "Employee",
"className": "Employee",
"collectionName": "EmployeeSelection",
"tableNumber": 1,
"scope": "public",
"dataURI": "/rest/Employee",
"attributes": [
{
"name": "ID",
"kind": "storage",
"scope": "public",
"indexed": true,
"type": "long",
"identifying": true
},
{
"name": "firstname",
"kind": "storage",
"scope": "public",
"type": "string"
},
{
"name": "lastname",
"kind": "storage",
"scope": "public",
"type": "string"
},
{
"name": "employer",
"kind": "relatedEntity",
"scope": "public",
"type": "Company",
"path": "Company"
}
],
"key": [
{
"name": "ID"
}
]
}
]
}
$catalog/{dataClass}
Renvoie des informations sur une dataclass et ses attributs
Description
Calling $catalog/\{dataClass\}
for a specific dataclass will return the following information about the dataclass and the attributes it contains. Si vous souhaitez récupérer ces informations pour toutes les dataclasses dans le datastore de votre projet, utilisez $catalog/$all
.
Les informations que vous récupérez concernent :
- Dataclass
- Attribut(s)
- Méthode(s) le cas échéant
- Clé primaire
DataClass
Les propriétés suivantes sont retournées pour une dataclass exposée :
Propriété | Type | Description |
---|---|---|
name | String | Nom de la dataclass |
collectionName | String | Nom d'une entity selection dans la dataclass |
tableNumber | Number | Numéro de la table dans la base 4D |
scope | String | Scope de la dataclass (à noter que seules les dataclasses dont le Scope (portée) est publique sont affichées) |
dataURI | String | Un URI aux données de la dataclass |
Attribut(s)
Voici les propriétés de chaque attribut exposé qui sont retournées :
Propriété | Type | Description |
---|---|---|
name | String | Le nom de l’attribut. |
kind | String | Type d'attribut (stockage ou relatedEntity). |
fieldPos | Number | Position du champ dans la table de la base. |
scope | String | Portée de l'attribut (seuls les attributs dont la portée est publique apparaîtront). |
indexed | String | Si un type d'index a été sélectionné, cette propriété retournera true. Sinon, cette propriété n'apparaîtra pas. |
type | String | Type d'attribut de chaîne (booléen, blob, octet, date, durée, image, long, long64, numérique, chaîne, uuid ou mot) ou la dataclasse pour un attribut de relation N-> 1. |
identifying | Boolean | Cette propriété retourne True si l'attribut est la clé primaire. Sinon, cette propriété n'apparaîtra pas. |
path | String | Nom de la dataclass pour un attribut relatedEntity, ou nom de la relation pour un attribut relatedEntities. |
foreignKey | String | Pour un attribut relatedEntity, nom de l'attribut associé. |
inverseName | String | Nom de la relation opposée pour un attribut relatedEntity ou relatedEntities. |
Clé primaire
L'objet clé retourne le nom de l'attribut (name) défini comme clé primaire pour la dataclass.
Exemple
Vous pouvez récupérer les informations concernant une dataclass spécifique.
GET /rest/$catalog/Employee
Résultat :
{
name: "Employee",
className: "Employee",
collectionName: "EmployeeCollection",
scope: "public",
dataURI: "http://127.0.0.1:8081/rest/Employee",
defaultTopSize: 20,
extraProperties: {
panelColor: "#76923C",
__CDATA: "\n\n\t\t\n",
panel: {
isOpen: "true",
pathVisible: "true",
__CDATA: "\n\n\t\t\t\n",
position: {
X: "394",
Y: "42"
}
}
},
attributes: [
{
name: "ID",
kind: "storage",
scope: "public",
indexed: true,
type: "long",
identifying: true
},
{
name: "firstName",
kind: "storage",
scope: "public",
type: "string"
},
{
name: "lastName",
kind: "storage",
scope: "public",
type: "string"
},
{
name: "fullName",
kind: "calculated",
scope: "public",
type: "string",
readOnly: true
},
{
name: "salary",
kind: "storage",
scope: "public",
type: "number",
defaultFormat: {
format: "$###,###.00"
}
},
{
name: "photo",
kind: "storage",
scope: "public",
type: "image"
},
{
name: "employer",
kind: "relatedEntity",
scope: "public",
type: "Company",
path: "Company"
},
{
name: "employerName",
kind: "alias",
scope: "public",
type: "string",
path: "employer.name",
readOnly: true
},
{
name: "description",
kind: "storage",
scope: "public",
type: "string",
multiLine: true
},
],
key: [
{
name: "ID"
}
]
}
singletons
If you have defined interprocess (shared) singletons containing at least one exposed function, a singletons
section is added to the returned json for both the /$catalog
and /$catalog/$all
syntaxes. It contains the collection of singleton classes as objects with their name and methods (i.e., exposed functions).
Singleton functions can be called by REST requests using the $singleton
command.
Exemple
GET /rest/$catalog/$all
Résultat :
{...
singletons": [
{
"name": "VehicleFactory",
"methods": [
{
"name": "buildVehicle",
"allowedOnHTTPGET": false,
"exposed": true
}
]
}
],
dataClasses: [...]
}