|
| 1 | +--- |
| 2 | +title: Create an external data model in a data model |
| 3 | +sidebar_label: Create an external data model in a data model |
| 4 | +description: This workflow sample demonstrates how to create an external data model in a data model through the Modeling service. |
| 5 | +--- |
| 6 | + |
| 7 | +<Available since="Strategy ONE (January 2026)" /> |
| 8 | + |
| 9 | +:::tip |
| 10 | + |
| 11 | +You can try out this workflow at [REST API Playground](https://www.postman.com/microstrategysdk/microstrategy-rest-api/collection/5aq5sem/strategy-rest-api-workflows). |
| 12 | + |
| 13 | +Learn more about Strategy REST API Playground [here](/docs/getting-started/playground.md). |
| 14 | + |
| 15 | +::: |
| 16 | + |
| 17 | +This workflow sample demonstrates how to create an external data model in a data model through the Modeling service. |
| 18 | + |
| 19 | +:::info |
| 20 | + |
| 21 | +Get the authorization token needed to execute the request with [POST /api/auth/login](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Authentication/postLogin). |
| 22 | + |
| 23 | +Get the project ID from [GET /api/projects](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Projects/getProjects_1). |
| 24 | + |
| 25 | +::: |
| 26 | + |
| 27 | +:::tip |
| 28 | + |
| 29 | +Changesets are used in this workflow. For information on how to create and use changesets, see [Changesets](/docs/common-workflows/modeling/changesets.md). |
| 30 | + |
| 31 | +::: |
| 32 | + |
| 33 | +You can create an external data model in a data model using the following endpoint: [POST /api/model/dataModels/\{dataModelId}/externalDataModels](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Data%20Models/postExternalDataModel). |
| 34 | + |
| 35 | +Sample Request Header: |
| 36 | + |
| 37 | +```http |
| 38 | +"accept": "application/json" |
| 39 | +"X-MSTR-AuthToken": "o0ak9privdo27nfo798j40m8aa" |
| 40 | +"X-MSTR-MS-Changeset": "805C5F3FB78A436FAE37C943471C24AD" |
| 41 | +``` |
| 42 | + |
| 43 | +Sample Request Body: |
| 44 | + |
| 45 | +```json |
| 46 | +{ |
| 47 | + "baseDataModel": { |
| 48 | + "objectId": "FF2970B298464D88806CCD39F1BA1919", |
| 49 | + "subType": "report_emma_cube", |
| 50 | + "name": "data model 1" |
| 51 | + }, |
| 52 | + "alias": "external data model 1" |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +Sample Curl: |
| 57 | + |
| 58 | +```bash |
| 59 | +curl -X POST "https://demo.microstrategy.com/MicroStrategyLibrary/api/model/dataModels/04DCF4F028354FC0AE4B8120CB1983A6/externalDataModels" -H "accept: application/json" -H "X-MSTR-AuthToken: o0ak9privdo27nfo798j40m8aa" -H "X-MSTR-MS-Changeset: 805C5F3FB78A436FAE37C943471C24AD" -H "Content-Type: application/json" -d '{"baseDataModel":{"objectId":"FF2970B298464D88806CCD39F1BA1919","subType":"report_emma_cube","name":"data model 1"},"alias":"external data model 1"}' |
| 60 | +``` |
| 61 | + |
| 62 | +Sample Response Body: |
| 63 | + |
| 64 | +```json |
| 65 | +{ |
| 66 | + "id": "AE2FC8E446B14162BF2BCAC64981D5A2", |
| 67 | + "baseDataModel": { |
| 68 | + "objectId": "FF2970B298464D88806CCD39F1BA1919", |
| 69 | + "subType": "report_emma_cube", |
| 70 | + "name": "data model 1" |
| 71 | + }, |
| 72 | + "alias": "external data model 1", |
| 73 | + "objects": [ |
| 74 | + { |
| 75 | + "objectId": "2877DDA7059B4FFE9DE2711F4D7CD29A", |
| 76 | + "subType": "attribute", |
| 77 | + "name": "Customer", |
| 78 | + "hidden": false, |
| 79 | + "alias": "Customer (2)" |
| 80 | + }, |
| 81 | + { |
| 82 | + "objectId": "B44A2F49F6B6441796FCA511F1BBFDA5", |
| 83 | + "subType": "attribute", |
| 84 | + "name": "Churn", |
| 85 | + "hidden": false, |
| 86 | + "alias": "" |
| 87 | + }, |
| 88 | + { |
| 89 | + "objectId": "3FDFCCEFB640428E9341D45B68073601", |
| 90 | + "subType": "attribute", |
| 91 | + "name": "Lifetime Value Score", |
| 92 | + "hidden": false, |
| 93 | + "alias": "" |
| 94 | + } |
| 95 | + ] |
| 96 | +} |
| 97 | +``` |
| 98 | + |
| 99 | +Response Code: 201 (A new external data model is created successfully in the changeset.) |
0 commit comments