---
title: "Generate a diff and a MAQL DDL script"
method: POST
path: "/gdc/projects/{projectId}/model/diff"
tags: ["logicaldatamodel"]
---

# Generate a diff and a MAQL DDL script

`POST /gdc/projects/{projectId}/model/diff`

## Request

- Base URL: `https://secure.gooddata.com`
- URL: `https://secure.gooddata.com/gdc/projects/{projectId}/model/diff`
- Auth: none declared

This method generates MAQL DDL scripts that you can use to update a project model and returns the link to a polling resource that returns the diff with the MAQL DDL scripts.</br>
The diff between the two models is represented by script operations that you can execute on the current project model to make it equal to the submitted `targetModel`. If no difference exists between the current model and its `targetState`, the returned list of update operations is empty.</br>
This example simulates the generation of a MAQL script for the model included in the example response of the resource for [viewing a project model](#operation/viewProjectModel). The target model contains one extra fact, `fact.employee.age`.

## Request body

- DiffRequest
  - `diffRequest` object, required
    - `targetModel` ProjectModel1, required
      - `projectModel` object, required
        - `modelMetadata` ModelMetadata
          - `containCA` boolean: true if the model is generated including computed attributes
        - `datasets` PmDataset1[], nullable
          - `dataset` PmDatasetRequest, required
            - `identifier` string, required
            - `title` string, required
            - `description` string
            - `anchor` PmAttribute1
              - …
            - `attributes` PmAttribute1[]
              - …
            - `bridges` string[]
            - `facts` PmFact1[]
              - …
            - `references` string[]: IDs of referenced dataset / date dimensions
            - `summary` string, nullable
            - `production` boolean
        - `dateDimensions` PmDateDimension1[], nullable
          - `dateDimension` PmDateDimensionRequest, required
            - `name` string, required
            - `title` string, required
            - `urn` string
            - `identifier` string
            - `identifierPrefix` string
            - `bridges` string[]
            - `production` boolean

## Response `202`

Accepted - new MAQL generation task created

- AsyncTask: Deprecated taskman async task used in old API resources. It contains `link` element in singular which doesn't comply with our API rules.
  - `asyncTask` object, required
    - `link` AsyncTaskPollLink, required
      - `poll` string, uri, required: URI of the polling resource

## Other responses

- `400`: Not Found - diff with <diffId> does not exist
- `403`: Forbidden - the project does not exist

---

[API](https://skmtc.dev/gooddata/apis/gooddata-api-documentation.md) - [All operations](https://skmtc.dev/gooddata/apis/gooddata-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/gooddata/apis/gooddata-api-documentation/revisions/e5dc0ee6ab00?raw)
