Thursday, January 27, 2022

PowerBi REST API - A binary operator with incompatible types was detected. Found operand types 'Edm.String' and 'Edm.Guid' for operator kind 'Equal'.

 I was trying to query to get workspace with a certain ID.

Using this as the filter (id eq 9c02ab25-0e94-4835-92e6-62ac6460acd0): https://api.powerbi.com/v1.0/myorg/groups?%24filter=id%20eq%209c02ab25-0e94-4835-92e6-62ac6460acd0, causes it fail with the error

{
  "error": {
    "code": "InvalidRequest",
    "message": "A binary operator with incompatible types was detected. Found operand types 'Edm.String' and 'Edm.Guid' for operator kind 'Equal'."
  }
}


The fix is to put your GUID within single quotes: id eq '9c02ab25-0e94-4835-92e6-62ac6460acd0'

https://api.powerbi.com/v1.0/myorg/groups?%24filter=id%20eq%20'9c02ab25-0e94-4835-92e6-62ac6460acd0'


No comments: