API v2
Contents
API v2¶
The API version 2 uses the OpenAPI Specification for its documentation. It is available here.
If you want to query MOSP programmatically you can use PyMOSP, a Python library to access MOSP.
Clients using this API¶
MONARC Stats Service (with PyMOSP)
Examples¶
Create a new object¶
With curl:
object='[
{
"name": "New vulnerability",
"description": "Description of this new object",
"schema_id": 14,
"org_id": 2,
"json_object": {
"code": "10",
"description": "",
"label": "Possibility of installing correction programmes, updates, patches, hotfixes, etc.",
"language": "EN",
"uuid": "69fbfe01-4591-11e9-9173-0800277f0572"
},
"licenses": [
{
"license_id": "CC0-1.0"
}
]
}
]'
curl -X POST "https://objects.monarc.lu/api/v2/object/" -H "accept: application/json" -H "X-API-KEY: <your-token>" -H "Content-Type: application/json" -d $object
With PyMOSP:
import pymosp
token = os.getenv("MOSP_TOKEN")
mosp = pymosp.PyMOSP("https://objects.monarc.lu/api/v2/", token)
new_objects = [
{
"name": "Possibility of installing correction programmes, updates, patches, hotfixes, etc.",
"description": "",
"licenses": [{"license_id": "CC0-1.0"}],
"schema_id": 14,
"org_id": 16,
"json_object": {
"code": "10",
"description": "",
"label": "Possibility of installing correction programmes, updates, patches, hotfixes, etc.",
"language": "EN",
"uuid": "69fbfe01-4591-11e9-9173-0800277f0572",
}
}
]
r = mosp.add_objects(new_objects)