Join the Conversation

To sign in, use your existing MySonicWall account. To create a free MySonicWall account click "Register".

List of Error Codes for API Calls

I'm calling /api/sonicos/address-groups/ipv4/name/ to add an address object to a group. In some cases the address might already be a member and the API call will fail. Where do I find a list of error responses, like E_EXISTS when creating an address object that already exists?

This is on SonicOSX 7.0.1

Category: Developer Hub
Reply

Best Answer

  • CORRECT ANSWER
    JaimeJaime SonicWall Employee
    Answer ✓

    That's a great question, @maximtech. I see references to the error codes but haven't found a comprehensive list of them. I'll take this feedback back to the team. Here are a few error codes that I'm aware of:

    E_OK: Usually accompanies by a Success message and HTTP 200.

    E_UNAUTHORIZED: Unauthenticated or lacks permissions.

    E_INVALID_API_CALL: Often accompanied by a message such as "API endpoint is incomplete" or "API does not support the content/verb requested". Can occur if you reach an invalid endpoint or not a complete endpoint (ex: sending a GET to /api/sonicos/address-groups/ without /ipv4 or /ipv6 in the endpoint) or if you send a request to an endpoint that doesn't support the verb (ex: sending a PUT to /api/sonicos/auth). It can also occur if you send an unexpected content type to the endpoint.

    E_EXISTS: As you've noted, this can occur if the configuration already exists (ex: creating an object that already exists).

    E_SYNTAX: An issue with the submitted content. Would be accompanied by a message such as "Schema validation error" or "Invalid input detected". Perhaps the JSON is not properly structured or is missing a key/value.

    E_RANGE: An out of bounds condition. Possibly a string or number was submitted in the request that is out of bounds or too long.

    E_READ_ONLY: An attempt to modify an item/property that is read-only will return this error code.

    E_NO_CHANGE: Sending a POST to /api/sonicos/config/pending while there are no changes to save would return this with the message "No changes made."

    Hope that helps.

    Jaime

Answers

  • maximtechmaximtech Newbie ✭

    Thanks for the info, very helpful!

    If adding an address object to a group and that object already is a member of the group, would it return E_EXISTS?

    Duane

  • JaimeJaime SonicWall Employee

    What method are you using in your request? What is the endpoint you are sending the request to? What firmware release are you running (7.0.1-5050, 5030, etc.)? Any additional detail about the request could be helpful.

    I've tested modifying memberships on 6.5.4.9 and 7.0.1-5050. In both versions, I am able to send and commit the modified group JSON successfully. I focused more on 7.0.1. I use PUT to replace the memberships with the supplied JSON, and PATCH to add members that did not already exist. I am able to PATCH the same JSON between commits, but when sending two identical PATCH requests (adding the same two members into the group) within one commit, you may see an error such as E_ERROR "Address Object in Group: Adding testobj2 to mygroup: Address object testobj2 overlaps with address object testobj2". PUT doesn't behave this way since you're replacing all members with the JSON I'm sending.

  • maximtechmaximtech Newbie ✭

    I'm calling /api/sonicos/address-groups/ipv4/name/ using the PATCH method to add an address object to a named group.

    This is on SonicOSX 7.0.1

  • JaimeJaime SonicWall Employee


    I also tested on SonicOSX 7.0.1-5050, and I'm not able to reproduce E_EXISTS when adding members to address groups using PATCH. I sent single membership additions, multiple memberships in the same group, and sent the current members plus a new member. In each instance, it worked without an error. I do receive E_ERROR if I send a PATCH with the same JSON twice and commit (trying to add the same memberships twice in a single commit). If it only send a PATCH with the JSON once and commit, it works fine. I need more context to understand the use case, shape my replication, and assist any further.

  • maximtechmaximtech Newbie ✭

    Ok, thank you for checking into that. I wanted to know which error codes to look for in my code based on what happens. Sounds like adding an address to a group when it already exists works fine and doesn't return an error code. That's part of what I needed to know. The other part about which error code is returned when an error occurs is also very helpful.

    Thank you!

    Duane

Sign In or Register to comment.