Changes between Version 78 and Version 79 of S3/S3XML
- Timestamp:
- 10/22/14 19:28:42 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3XML
v78 v79 190 190 191 191 ==== Schema Documents ==== 192 193 192 '''Schema documents''' describe the data schema for a resource. Clients can use these documents e.g. for automatic generation of forms. 194 193 … … 222 221 - the URL query parameter {{{?options=true}}} adds a list of field options to those fields where options are defined, and combined with the parameter {{{&reference=true}}}, even options for foreign key references will be included 223 222 - the URL query parameter {{{?meta=true}}} will include the meta fields (as <meta> elements). In data documents, the meta fields are to be encoded as attributes of the <resource> element 223 224 224 ==== Field Option Documents ==== 225 226 225 '''Field option documents''' describe the currently acceptable options for fields in a resource. Clients can use these documents e.g. for automatic generation and/or client-side validation of forms. 227 226 … … 246 245 - In the current S3 implementation, transformation of field option documents is not supported. JSON conversion is possible, though. 247 246 - Field option documents can only be requested (GET). Future versions may also accept submissions of such documents to update the data schema. 247 248 248 ==== Data Documents ==== 249 250 249 '''Data documents''' provide the current contents (data) of resources. 251 250 … … 275 274 276 275 ==== Components ==== 277 278 276 Component resources are <resource> elements inside of their primary <resource> element. 279 277 Component records will be automatically imported and the required key references be added (=no explicit reference-element required). … … 286 284 287 285 ==== References ==== 288 289 286 Foreign key references (except those linking components to their primary record) are represented by <reference> elements. 290 287 … … 300 297 301 298 ==== s3xml ==== 302 303 299 The root element (in schema and data documents). 304 300 … … 322 318 ||'''limit'''||integer||the maximum number of records returned (in paginated requests)||''no''|| 323 319 ||'''latmin''', '''latmax''', '''lonmin''', '''lonmax'''||float||geo-location boundary box of the results||''no''|| 320 324 321 ==== resource ==== 325 326 322 Represents a record (in data documents) or a database table (in schema documents). 327 323 … … 371 367 372 368 MCI handling is optional for non-synchronizing interfaces. 369 373 370 ==== data ==== 374 375 371 Represents the value of a single field in the record. 376 372 … … 403 399 404 400 ==== reference ==== 405 406 401 Represents a foreign key reference. 407 402 … … 444 439 == JSON Format == 445 440 To create new resources PUT to {{{http://host.domain/eden/module/resource.s3json}}} 441 442 To introspect a form, GET {{{http://host.domain/eden/module/resource.s3json?options=true&references=true}}} 443 444 JSON format characteristics: 445 446 * The JSON output contains _no_ whitespace between elements, it's just added here by hand for better readability 447 448 * The outermost structure is always a JSON object (not a list) 449 * All data is represented as strings (for security reasons) 450 451 * If @value is sent for a field, it overrides the element text ($) at import 452 * however, the use of @value is not mandatory, data can simply be placed instead of element text 453 * Note that there is no automatic data encoding: data must be sent in DB-encoded format 454 * no attributes are mandatory at input 455 * @tuid can be used instead of @uuid to link referenced records 456 457 * Multiple records of the same resource will be aggregated as lists like: 458 459 {{{ 460 { 461 $_my_resource: [ 462 { 463 // record1 of my_resource 464 } 465 { 466 // record2 of my_resource 467 } 468 ] 469 } 470 }}} 446 471 447 472 Example of creating a Disease Case: … … 464 489 } 465 490 }}} 491 492 466 493 == CSV Format == 467 468 494 The S3XML importer can represent uploaded single-sheet CSV files in a very simple XML format, whereby it becomes available for transformation into S3XML and import into Sahana-Eden. 469 495 … … 496 522 497 523 A number of pre-defined XSLT stylesheets for CSV import including a respective CSV template can be found in the static/formats/s3csv folder. 524 498 525 == Examples == 499 500 526 === XML Format === 501 527 … … 563 589 564 590 === JSON Format === 565 566 591 The data structure of the native S3JSON format is equivalent to the XML format (=element trees) - except that markup elements are represented by prefixes: 567 592 … … 607 632 } 608 633 }}} 609 610 '''JSON format characteristics:'''611 612 * The JSON output contains _no_ whitespace between elements, it's just added here by hand for better readability613 614 * The outermost structure is always a JSON object (not a list)615 * All data is represented as strings (for security reasons)616 617 * If @value is sent for a field, it overrides the element text ($) at import618 * however, the use of @value is not mandatory, data can simply be placed instead of element text619 * Note that there is no automatic data encoding: data must be sent in DB-encoded format620 * no attributes are mandatory at input621 * @tuid can be used instead of @uuid to link referenced records622 623 * Multiple records of the same resource will be aggregated as lists like:624 625 {{{626 {627 $_my_resource: [628 {629 // record1 of my_resource630 }631 {632 // record2 of my_resource633 }634 ]635 }636 }}}