# Custom model member

With the custom data type on a model member you can specify **external** (from the perspective of the REST project tool) data types. You use *Custom specification* to specify the type.

Currently the only available custom data types are types originating from the .NET Base Class Library (BCL). To use a type from BCL you prefix the full name of that type with 'bcl:', for instance 'bcl:System.TimeSpan'. Note that certainly not all types will work, and most of them will make no sense. You can consider this feature as an advanced one with ***limited support*** available. It is however powerful and useful in many scenarios and can save you a lot of development time and need of custom connectors by using it properly. Since it can reduce the need for custom connectors it also simplifies deployment and reduces maintenance.

So, after this warning, let's walk through an example of how it can be used.

Consider this scenario:

* You want to fetch pdf documents from a REST API
* The REST API returns the pdf documents as base64 encoded strings
* You want to store these documents in the filesystem, of course not as base 64 encoded string but as a pdf file.&#x20;

This is how the json looks like when returned from the server:

```
{
    Data: "JVBERi...base64 encode data...PDj8OT==",
    Name: "4cdda37a-fa71-1065-a761-141a4ebaf7d3",
    Extension: ".pdf",
    InvoiceId: "401757"
}
```

Since this is what the API will return, we need a model for it. This is quickly done with 'NEW FROM JSON' in the Model part of the REST Project Tool. See [Models](https://home.novacuraflow.com/Help/latest/?help_root_connectors_communication_rest_model) for more information on how to to that.

Once we've created the model it will look like this:&#x20;

![](/files/-M77Z8xmMwNNpvSM_bxN)

We now need a model that contains not the base 64 encoded string, but instead an instance of System.IO.Stream. Since this model will look almost the same as the 'Invoice' model, we can use the 'Clone model' feature. This is accessed by selecting the tree node for the model and right clicking: &#x20;

![](/files/-M77ZSbdtfRBrE0TPDEB)

We'll call this second model 'Invoice (binary)'. We now have two identical models:&#x20;

![](/files/-M77ZXwd9fp_MRB3_Ml_)

Next step is to change the data type of 'Data' in 'Invoice (binary)'. Select the 'Data' member and change 'Type' to 'Custom' and set 'Custom specification' to 'bcl:System.IO.Stream'.&#x20;

![](/files/-M77ZbPSCHJQkPXbCLdl)

Next step is to create a model transformation between the two models.&#x20;

![](/files/-M77ZfOxKqDeRdoUmRnm)

The code could look something like this:&#x20;

![](/files/-M77ZiUK689MA9t0QJBH)

Now this transformation can be applied to a GET operation&#x20;

![](/files/-M77ZldUeCLOHEN0UxDB)

Finally the workflow could look something like this:&#x20;

![](/files/-M77ZoQkWWKkEH14jWaz)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.novacuraflow.com/connectors/areas/communication/rest-service/rest-project-tool/models/custom-model-member.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
