The AddMetadata method
creates metadata objects. It is used to create both the metadata object
that defines a repository, and the metadata objects that are within
the repository. To update an existing metadata object, whether it
defines a repository or a metadata object within the repository, use
the UpdateMetadata method.
The INMETADATA parameter
specifies a metadata property string that defines the properties to
be added for the object. A request that creates a repository defines
an object of the RepositoryBase metadata type and is issued in the
REPOS namespace. A request that adds an object to a repository is
issued in the SAS namespace and defines SAS namespace metadata types.
Not all metadata types or their properties can be added. See the documentation
for each metadata type. AddMetadata returns an error for any metadata
type that cannot be added.
An AddMetadata request
that creates the metadata object that defines a repository does not
automatically create the physical directory specified in the Path
attribute. You must create the physical directory specified in the
Path attribute in advance. Or, you can pass the <CREATEREPOSCONTAINER/>
element in the AddMetadata request to create the physical directory.
The Path attribute accepts an absolute or relative pathname. Use backslashes
or forward slashes (\ and /) to indicate the directory levels. <CREATEREPOSCONTAINER/>
creates one directory, and it will be the last directory in the specified
path. If the other directories in the path do not exist, the SAS Metadata
Server returns an error.
The OUTMETADATA parameter
mirrors the content of the INMETADATA parameter. In addition, it returns
identifiers for the requested objects. Any invalid properties in the
INMETADATA metadata property string remain in the OUTMETADATA metadata
property string.
For information about the structure of the metadata property string,
see Constructing a Metadata Property String.
The AddMetadata method
can be used to create an object only, to create an object and an association
to an existing object, or to create an object, an association, and
the associated object. Associations to objects can be made in the
same repository or in a different repository. The attributes defining
the objects indicate the type of operation to be performed.
For more information,
see Adding Metadata Objects.
Objects and associations
are created subject to security constraints. For example, a requestor
must have administrative status on the SAS Metadata Server to add
a repository. A requestor must have WriteMetadata permission to a
repository to add an object to the repository. When creating an association
between a new object and an existing object, the requestor must have
WriteMetadata permission either to the existing object, or to the
repository in which the existing object resides.
The SAS Metadata Server
assigns object identifiers after the successful completion of an AddMetadata
request.
Check the return code
of an AddMetadata method call. A nonzero return code indicates that
a failure occurred while trying to write the metadata. A nonzero return
code means none of the changes in the method call were made.