@POST
    public ExternalType createObject(ExternalType object)
            throws GuacamoleException {

        // Validate that data was provided
        if (object == null)
            throw new GuacamoleClientException("Data must be submitted when creating objects.");

        // Filter/sanitize object contents
        InternalType internal = filterAndTranslate(object);

        // Create the new object within the directory
        try {
            directory.add(internal);
            fireDirectorySuccessEvent(DirectoryEvent.Operation.ADD, internal.getIdentifier(), internal);
            return object;
        }
        catch (GuacamoleException | RuntimeException | Error e) {
            fireDirectoryFailureEvent(DirectoryEvent.Operation.ADD, internal.getIdentifier(), internal, e);
            throw e;
        }

    }
Creates a new object within the underlying Directory, returning the
object that was created. The identifier of the created object will be
populated, if applicable.

@param object
    The object to create.

@return
    The object that was created.

@throws GuacamoleException
    If an error occurs while adding the object to the underlying
    directory.
guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryResource.java