This document outlines the endpoints that are available when running gactar as a web server (i.e. by passing -w
on the command line).
Important Note: The web API is intended for local use only. It should not be used to expose gactar to the internet. It is not designed for security or to prevent abuse.
Get the version of gactar being run.
(none)
version string
The current version tag when gactar was built.
http://localhost:8181/version
Result:
{
"version": "v0.2.0"
}
amod string
The amod code to run.
goal string
The initial goal.
Map of results - one entry for each framework that was run.
modelName string
The name of the model (comes from the amod code).
code string
The generated code for the given framework.
output string
The output of running the model on the framework.
http://localhost:8181/run
Request payload:
{
"amod": "==model==\nname: count\n ...",
"goal": "countFrom: 2 5 starting"
}
Result:
{
"results": {
"ccm": {
"modelName": "count",
"code": "# Generated by gactar v0.2.0 ...",
"output": " 0.000 production_match_delay 0 ...\n"
},
"pyactr": {
"modelName": "count",
"code": "# Generated by gactar v0.2.0 ...",
"output": "(0, 'PROCEDURAL', 'CONFLICT RESOLUTION') ..."
},
"vanilla": {
"modelName": "count",
"code": ";;; Generated by gactar v0.2.0 ...",
"output": "0.000 GOAL SET-BUFFER-CHUNK GOAL GOAL NIL ..."
}
}
}
Get a list of the available examples built-in to the server.
(none)
example_list string array
The amod file names which may be used with the /examples/[example_name]
endpoint.
http://localhost:8181/examples/list
Result:
{
"example_list": [
"addition.amod",
"addition2.amod",
"count.amod",
"semantic.amod",
"topdown_parser.amod"
]
}
Get the specified built-in example from the server.
The name of the example (as part of the URL).
The amod code for the requested example. (Note that it is not JSON like the other endpoints - it is straight text.)
http://localhost:8181/examples/count.amod
Result:
==model==
// The name of the model (used when generating code and for error messages)
name: count
...
(none)
sessionID integer
The id of the new session.
http://localhost:8181/session/begin
Result:
{
"sessionID": 1
}
sessionID integer
The id of the session to end.
(none)
http://localhost:8181/session/end
Request payload:
{
"sessionID": 1
}
sessionID integer
The id of the session.
modelID integer
The ID of the model to run.
buffers string
The initial contents of the buffers.
includeCode boolean
Whether to include the generated code as part of the response. (default: false)
Map of results - one entry for each framework that was run.
modelName string
The name of the model (comes from the amod code).
code string
The generated code for the given framework.
output string
The output of running the model on the framework.
sessionID integer
The id of the session.
modelID integer
The ID of the model which was run.
http://localhost:8181/session/runModel
Request payload:
{
"sessionID": 1,
"modelID": 1,
"buffers": {
"goal": "countFrom: 2 5 starting"
}
}
Result:
{
"results": {
"ccm": {
"modelName": "count",
"output": " 0.000 production_match_delay 0 ...\n",
"sessionID": 7,
"modelID": 2
},
"pyactr": {
"modelName": "count",
"output": "(0, 'PROCEDURAL', 'CONFLICT RESOLUTION') ...",
"sessionID": 7,
"modelID": 2
},
"vanilla": {
"modelName": "count",
"output": "0.000 GOAL SET-BUFFER-CHUNK GOAL GOAL NIL ...",
"sessionID": 7,
"modelID": 2
}
}
}
Given a model (amod code), compile and store it on the server. It returns an id to use to reference the model.
amod string
The amod code to load.
sessionID integer
The id of the session to load this model in.
modelID integer
The ID of this model to use in other calls to the API.
modelName string
The name of the model (comes from the amod code).
sessionID integer
The id of the session.
http://localhost:8181/model/load
Request payload:
{
"amod": "==model==\nname: count\n ...",
"sessionID": 1
}
Result:
{
"modelID": 1,
"modelName": "count",
"sessionID": 1
}