Skip to content

Allow to specify read_path in datasource #328

@joelMuehlena

Description

@joelMuehlena

When using the datasource to fetch data I can specify the path but not the getPath for the following readObject(). In my case this leads to an error, because the API expects a trailing slash and the {id} suffix is appended without a slash and the option to alter the used path.

E.g.

data "restapi_object" "user_admin" {
  path              = "/api/users/"
  query_string      = "username__iexact=admin"
  read_query_string = ""
  results_key       = "results"
  search_key        = "username"
  search_value      = "admin"
  debug             = true
}

throws an error because the provider tries a get to /api/users/{id} but should get from /api/users/{id}/.

Request:

Add the read_path attribute like it's done on the resource object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions