the documentation is still being worked on, but it should be available soon.
To use REST there are come examples with CURL available which you can try on the command line.
1.) Write the REST URL into a variable (easier to read later):
2.) You need to authenticate with valid credentials. MWG will return a Cookie which you need for further requests to be authenticated:
curl -i -c cookies.txt -H "Authorization: Basic YWRtaW46d2ViZ2F0ZXdheQ==" -X POST "$REST/login"
curl -i -b cookies.txt "$REST/appliances"
3.) You can see all available lists by using
curl -i -b cookies.txt "$REST/list"
4.) You can create an empty list with
curl -i -b cookies.txt -X POST "$REST/list?name=newlist&type=category"
5.) Get a list
curl -i -b cookies.txt "$REST/list/com.scur.type.mediatype.4532"
6.) Get list entry
curl -i -b cookies.txt "$REST/list/com.scur.type.mediatype.4532/entry/1"
7.) Delete list entry
curl -i -b cookies.txt -X DELETE "$REST/list/com.scur.type.mediatype.4532/entry/1"
8.) Modify list entry
curl -i -b cookies.txt -X PUT -d @listEntryRequest.xml "$REST/list/com.scur.type.regex.11347/entry/1" -H "Content-Type: application/xml"
where "listEntryRequest.xml" is a file which contains the new entry, such as:
I hope this helps. Rule modification is not yet possible as far as I know. If you need specific examples, just let me know, I will try to provide them.
The current implementation of of REST on MWG only allows you to do certain functions.
Logs and file server files:
list of directories and log files
download log file
delete log file
list of files
And manipulate lists. Add/Remove/Modify/etc.
It does not provide access tot he rules or policy, other than the list contents.
the retrieving and uploading of lists works on MWG 7.1.6, but if trying to delete an entry I get a parser output "org.apache.abdera.parser.stax.FOMEntry...".
the beta 7.2.0 shows no error message but the entry still present, cannot be deleted.
can you check this issue? Is it a bug or the "delete" requieres an another syntax?
to delete a list you just need to issue a DELETE request using the list-ID. Following the examples posted earlier it should look like this:
curl -i -b cookies.txt -X DELETE "$REST/list/com.scur.type.regex.4537"
Can you give an example of the request you are sending? So far I haven't seen the error you mentioned.
Yes, that's a bug. The command is correct and should work. I can reproduce the error with MWG 188.8.131.52.
I can't reproduce it with MWG 7.2 (which will be released fairly soon), so it seems that it's fixed. Deleting entries or the whole list worked fine in my test and after a commit the changed entries or the list was actually gone. I tested with the latest internal MWG 7.2 build, I haven't checked with the Beta build yet.
If you need the fix to be backported to the 7.1.6 branch, please raise a ticket with support.