One or more date variables are missing in `requested_dates` field.

I’m using the /project_templates/{gid}/instantiateProject endpoint, as documented here:

When I try to POST, I’m only able to use the start date value, not the due date . If I use Due date, I get the error ’ One or more date variables are missing in requested_dates field.’

This is done by referencing a GID in the requested_date object (1 is start date, 2 is due date).

This works:

{
  "data": {
    "name": "TestName1",
    "team": "x",
    "public": true,
    "requested_dates": [
      {
        "gid": "1",
        "value": "2023-02-17"
      }
    ]
  }
}

This doesn’t:

{
  "data": {
    "name": "TestName1",
    "team": "x",
    "public": true,
    "requested_dates": [
      {
        "gid": "2",
        "value": "2023-02-17"
      }
    ]
  }
}

I am not sure about the API itself in this case, but I believe you are missing an info: a template is either based on start date OR end date. This is built-in. You can change it (by editing a single date and clicking on the button in the popup there) but once defined, you can’t I believe change strategy through the API.

Does it help clarify?

@DSmith,

@Bastien_Siebman is on the right track in his answer. To elaborate:

A project template will either be defined a operating from its start date or its due date:

This can be changed by the method Bastien mentions.

When you instantiate a project template via the API, the key parameter for your question is the is_strict parameter.

is_strict = true is the default. If you include is_strict = true or you omit the parameter, then the requested_date gid must match the anchor-date setting inside the template. So in your case, you must have the template set to be anchored to the project start date, but you passed a gid of 2 which doesn’t match, hence the error.

You can bypass this by sending is_strict = false, in which case Asana will not require that your gid type and the internal setting match.

1 Like