Issue REST API
If you want to build a custom Simscope bug integration/plugin, here is a basic introduction, using Curl from the command-line.
Curl prerequisites
To run any of the following commands, make sure you have the Curl API working.
Note: replace
SERVER
with your simscope server hostname (or IP address).
Sample JSON Issue
Here is a sample Issue SIM-37
rendered via JSON
:
{
"bugid": "SIM-37",
"project": "Simscope",
"title": "Simscope Signature 1183: FAIL TestJobSearchParse ...",
"component": "Server",
"branch": "",
"designation": "DV",
"state": "To Do",
"priority": "Medium",
"reporter_email": "payton@verops.com",
"assignee_email": "fred@verops.com",
"created": "2019-11-13T20:40:13.531-05:00",
"updated": "2019-11-14T14:20:11.102-05:00",
"resolved": "0001-01-01T00:00:00Z",
"url": ""
}
Get issue via Curl
> curl --location --data-urlencode "apitoken@$HOME/.simscope.apitoken" -G \
"http://SERVER:8080/api/issues/BUG-ID"
- replace
BUG-ID
with your bug ID
replace
server
with your simscope server hostname (or IP address)
Example JSON
response:
{
"bugid": "SIM-37",
"project": "Simscope",
"title": "Simscope Signature 1183: FAIL TestJobSearchParse ...",
"component": "Server",
"branch": "",
"designation": "DV",
"state": "To Do",
"priority": "Medium",
"reporter_email": "payton@verops.com",
"assignee_email": "payton@verops.com",
"created": "2019-11-13T20:40:13.531-05:00",
"updated": "2019-11-14T14:20:11.102-05:00",
"resolved": "0001-01-01T00:00:00Z",
"url": ""
}
Post issue via Curl
To add (or update) an issue:
- Save the issue metadata as a JSON file called
bug-test.json
:
{
"bugid": "SIM-1",
"project": "Simscope",
"title": "Hello world, this is a bug",
"component": "test-bug-component",
"branch": "",
"designation": "RTL",
"state": "To Do",
"priority": "Medium",
"reporter_email": "payton@verops.com",
"assignee_email": "john@verops.com",
"created": "2020-12-18T13:43:07.462-05:00",
"updated": "2020-12-18T13:43:07.462-05:00",
"resolved": "0001-01-01T00:00:00Z",
"url": ""
}
- Run the following command (replace
SERVER:8080
):
> curl --location --data-urlencode "apitoken@$HOME/.simscope.apitoken" \
--header "Content-Type: application/json" \
-XPOST "http://server:8080/api/issues/TEST-BUG-1000" --data @bug-test.json
If successful, you should see a JSON
response:
{
"bugid": "TEST-BUG-1000",
"project": "Simscope",
"title": "Hello world, this is a bug",
"component": "test-bug-component",
"branch": "",
"designation": "RTL",
"state": "To Do",
"priority": "Medium",
"reporter_email": "payton@verops.com",
"assignee_email": "john@verops.com",
"created": "2020-12-18T13:43:07.462-05:00",
"updated": "2020-12-18T13:43:07.462-05:00",
"resolved": "0001-01-01T00:00:00Z",
"url": ""
}
View the bug metadata
Open your browser and go to http://server:8080/issues/TEST-BUG-1000
:
Error 409: Stale update timestamp
If you get an response similar to the following:
{
"code": 409,
"error": "issue {TEST-BUG-1000} stale update timestamp: 2020-12-18T13:43:07-05:00"
}
This is a warning, indicating you are updating a bug with an updated
timestamp that is
not newer than Simscope's cache of the bug, so Simscope has skipped updating it.
- This prevents Simscope from doing a redundant bug update.
- To override this, use a newer
updated
timestamp.
Download list of all bugs in Simscope
To download a list of all bugs known in Simscope (so you can query a list of bugs in an external bug tracker):
> curl --location --data-urlencode "apitoken@$HOME/.simscope.apitoken" -G \
"http://server:8080/api/issues/?all"
If successful, you should see a JSON
array response similar to the following:
[
".842-fixed",
".LOW_PRIORITY",
".bzCompileFailed",
".my-tag",
".rule-tag-without-hits",
".testbench",
".timeout",
".verops-86",
".working",
"12345",
"1249",
"12888x"
]