# IRPCDeclarativeMetadataStructure.SetDeclarativeMetadataStructure

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [Declarative metadata structure](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/SetDeclarativeMetadataStructure/

Badges: `Administration API / specialized` `admin` `session` `returns metadata structure version`

Validates a declarative JSON document against the schema, or converts it for deployment.

- **Service:** [Declarative metadata structure](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/index.md) `MFiles.IRPCDeclarativeMetadataStructure`
- **gRPC method:** `/MFiles.IRPCDeclarativeMetadataStructure/SetDeclarativeMetadataStructure`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/set-declarative-metadata-structure`
- **Request:** [`SetDeclarativeMetadataStructureRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/SetDeclarativeMetadataStructure/index.md#request)
- **Response:** [`SetDeclarativeMetadataStructureResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/SetDeclarativeMetadataStructure/index.md#response)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** no
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Fails with "Not implemented." unless deploying declarative structures is enabled on the server.
- Requires `change_metadata_structure`.
- With `dry_run_with_schema_validation` true, nothing changes: `validated` is true and
  `validation_errors` lists the schema violations (empty when the document is valid).
- With `dry_run_with_schema_validation` false, the server converts the document but, in this
  server version, does not apply the result to the vault.
- `session` is not used; the begin and end session methods are not implemented.

<a id="request"></a>

## Request: SetDeclarativeMetadataStructureRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `session` | `uint32` | Not used by the server. Leave 0. |
| `declmds_as_json` | `string` | The declarative metadata structure document, as returned by [GetDeclarativeMetadataStructure](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/GetDeclarativeMetadataStructure/index.md). |
| `dry_run_with_schema_validation` | `bool` | True to only validate the document against the schema. |

<a id="response"></a>

## Response: SetDeclarativeMetadataStructureResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `validated` | `bool` | True when the call was a dry run. |
| `validation_errors` | `string` | The schema validation errors as text, empty if the document is valid. Set only when `validated` is true. |

<a id="related"></a>

## Related methods

- [SetDeclarativeMetadataStructureBeginSession](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/SetDeclarativeMetadataStructureBeginSession/index.md): Reserved for setting a structure in several parts. Not implemented.
- [SetDeclarativeMetadataStructureEndSession](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDeclarativeMetadataStructure/SetDeclarativeMetadataStructureEndSession/index.md): Reserved for setting a structure in several parts. Not implemented.
