![]() You should always aim to use the last access token issued. An access token is generated with every request (except logon) and any of the last 20 (by default, settable in the configuration) will be accepted. If we want to create a new item, use a http verb of POST^ and include an access token. To execute a discovery, task or baseline, use the same format - ID/execute. So to execute a query, make a GET request to. What about running a query? What's the HTTP verb used to EXECUTE something? There is none But we'll make do by supplying /execute after the ID. That's it - easyĪnd if we want to read a specific entry, it's just a GET request. Supply the data attribute in the body → x-Deleteĭeleting an item is the even easier. Make a new PATCH request and use the URL. So now you have your payload, let's send it to Open-AudIT. Because we're using Postman, we'll have to do it ourselves. Normally you would use code to do this, so it's a simple two line conversion. Your JSON object should look like below (formatted and indented for easy reading). You'll need to create a JSON object and assign it to the "data" item to do this. Let's change the description for our device with ID 14. Include this in your request body as below.Īttribute names are visible in the application by going to menu → Admin → Database → List Tables and clicking on the "system" table. Run another query (a GET is fine, even if no items are returned) and parse the JSON reponse for meta → access_token. You will need a token when submitting a POST or PATCH request. You'll need the ID of the device you want to change, along with the attribute name from the database and an access token.Īccess tokens are generated with every request type. What about changing the attribute of an item? Not too difficult. You can see the start of the JSON in the screenshot below. Make a GET request to and you should get a JSON response containing a list of devices. Once that's done, it's time to request some data. You should see the JSON result saying you have been authenticated. Set the Body to form-data and provide the username and password keys, with values as appropriate for your installation. Set the header Accept to application/json. You should substitute the IP address of your Open-AudIT server.įirst you need to make a post to /login to get a cookie. Let's do thatįor the below, my Open-AudIT server is running on 192.168.84.4. ![]() You can also elect to create a new item using the wizard, or just close the modal and jump in. You can elect to create an account or not. You can get it from for Windows, Mac and Linux. Just using a browser, it's difficult to send anything other than a GET request - but Postman makes it simple to send a POST, PATCH or DELETE as required. I often utilise Postman to query the Open-AudIT API when developing.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |