SonicOS API error on Content Filter URI update
Hi,
I'm using the SonicOS API with NodeJs.
I can request GET withou problem. However, the POST/PUT/PATCH methods seems broken.
I'm trying to make a PUT request at 'https://{URL}/api/sonicos/content-filter/uri-list-groups/uuid/{UUID}' acording the API docs and the return is always the same:
"level": "error",
"code": "E_NO_MATCH",
"message": "Command 'object Object]' does not match"
The request body (In PUT or PATCH) is:
{
"content_filter": {
"uri_list_group": [
{
"name": "string",
"uri_list_object": [
{
"name": "string"
}
],
"uri_list_group": [
{
"name": "string"
}
]
}
]
}
}
What am I doing wrong?
Tks!
Best Answers
-
Pocho Newbie ✭
@rerisson_fumes what is it that you are trying to do? I just tested it really quick with postman and the path seems correct and works correctly. The error you are showing makes it sound like the UUID you used on the URI was not found or not the correct one, it really shouldn't make a difference if you do it on nodejs or anywhere else, I would say print the full URI as it is send to the unit from nodejs and make sure everything looks correct on the uuid part
1 -
MustafaA SonicWall Employee
Hey @rerisson_fumes , probably you are getting this error because your "Content-Type" in the "Headers" is not set to "application/json". That's what I can see from my end when I do the the tests with "text/plain" and "application/json" using the same end point and same JSON content (per spec/model). Here are my screen captures, and hoping it will give you some inspiration.
Content-Type: text/plain
Content-Type: application/json
1
Answers
Hi @Pocho and @MustafaA
Really, I wasn't setting "Content-Type" in the "Headers" to "application/json".
Also, I was not converting payload value with "JSON.stringify".
After correcting these points my application worked as expected.
Thanks!