evaluate golang on building up traceable document system
- run gxdoc
- a config.ini file will be generated at same directory of gxdoc executable binary
- edit config.ini with any text editor
HTTP Method | URL | Description |
---|---|---|
GET | /api/document/schema-infos | get all schema summary |
POST | /api/document/schema-infos | register a new schema |
GET | /api/document/schema-infos/{schema-name} | get specific schema summary |
POST | /api/document/schema-infos/{schema-name} | update schema summary |
GET | /api/document/schemas/{schema-name} | get latest schema definition |
POST | /api/document/schemas/{schema-name} | update schema definition |
GET | /api/document/schemas/{schema-name}/revisions/{revision-number} | get specific schema definition by revision number |
GET | /api/document/schemas/{schema-name}/draft | get draft version of schema definition |
POST | /api/document/schemas/{schema-name}/draft | update draft version of schema definition |
POST | /api/document/{schema-name}/validate | validate data with XML or JSON format |
NOTE: {dev-start-url} is defined in config.ini file
URL Pattern:
GET /api/document/schema-infos
Output:
{
"response": [
{
"name": "pr",
"latestRev": 1,
"desc": "purchase requisite",
"isActive": true,
"hasDraft": true
},
{
"name": "invoice",
"latestRev": 3,
"desc": "invoice....",
"isActive": true,
"hasDraft": false
}
]
}
URL Pattern:
GET /api/document/schema-infos/{schema-name}
Output:
{
"response": {
"name": "pr",
"latestRev": 1,
"desc": "purchase requisite",
"isActive": true,
"hasDraft": true
}
}
URL Pattern:
POST /api/document/schema-infos
Input Data (sample):
{
"name":"po",
"desc":"purchase order"
}
URL Pattern:
POST /api/document/schema-infos/{schema-name}
Input Data (sample):
{
"name":"po",
"desc":"new PO description",
"isActive": true
}
URL Pattern:
GET /api/document/schemas/{schema-name}
Output:
<?xml version="1.0"?>
<dxdoc name="invoice" revision="3" id="">
<dxstr name="invNo"></dxstr>
<dxint name="totalQty" isOptional="true"></dxint>
<dxdecimal name="price" precision="2"></dxdecimal>
</dxdoc>
URL Pattern:
GET /api/document/schemas/{schema-name}/revision/{revision-number}
Output:
<?xml version="1.0"?>
<dxdoc name="invoice" revision="2" id="">
<dxstr name="invNo"></dxstr>
<dxint name="totalQty" isOptional="true"></dxint>
<dxdecimal name="price" precision="6"></dxdecimal>
</dxdoc>
NOTE: newly update schema definition will register as new definition with higher revision number. previous definition will remain intact in database
URL Pattern:
POST /api/document/schemas/{schema-name}
Input Data (sample):
<?xml version="1.0"?>
<dxdoc name="invoice" revision="0" id="">
<dxstr name="invNo"></dxstr>
<dxint name="totalQty" isOptional="true"></dxint>
<dxdecimal name="price" precision="2"></dxdecimal>
<dxbool name="needAudit"></dxbool>
</dxdoc>
URL Pattern:
GET /api/document/schemas/{schema-name}/draft
Output:
<?xml version="1.0"?>
<dxdoc name="invoice" revision="-1" id="">
<dxstr name="invNo"></dxstr>
<dxint name="totalQty" isOptional="true"></dxint>
<dxdecimal name="price" precision="2"></dxdecimal>
</dxdoc>
NOTE: newly posted schema definition will overwrite previous draft definition!
URL Pattern:
POST /api/document/schemas/{schema-name}/draft
Input Data (sample):
<?xml version="1.0"?>
<dxdoc name="invoice" revision="0" id="">
<dxstr name="invNo"></dxstr>
<dxint name="totalQty" isOptional="true"></dxint>
<dxdecimal name="price" precision="2"></dxdecimal>
</dxdoc>
URL Pattern:
POST /api/document/{schema-name}/validate
Input Data (XML sample):
please set 'Content-Type' to 'text/xml'
<book>
<name>Oliver's Travel</name>
<author>John Doe</author>
</book>
Input Data (JSON sample):
please set 'Content-Type' to 'application/json'
{
"name": "Oliver's Travel",
"author": "John Doe"
}
Output:
{
"response": {
"isValid": true,
"message": ""
}
}