Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Odata error when querying SAP SF ODATA API using PowerBI odata

I can query SAP SF using the below get request from Postman but cant query using the same using Power BI

 

https://<API-Server>/odata/v2/PerPersonal?$filter=firstName like 'Ca%' or lastName like 'Ca%'&$select=firstName,lastName&$format=JSON
 

 

Documentation of API :

https://help.sap.com/viewer/b2b06831c2cb4d5facd1dfde49a7aab5/2011/en-US/925c252b03e54de08ff7d1d77264dc18.html

 

 

Error:

Details: "OData: The feed's metadata document appears to be invalid. Error: The metadata document could not be read from the message content.
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 1606986)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 2607067)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 2607837)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 2608134)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 2608656)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 2790133)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 4904745)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 4928270)
UnexpectedXmlAttribute : The attribute 'CollectionKind' was not expected in the given context. : (1, 4929056)
UnexpectedXmlAttribute..."
  • Hi Anonymous ,

     

    Would you please try to use web data source instead of OData feed? It seems that it will not work when you use odata for SAP SF based on my research.

     

    Would you please try to create a new blank query and use something like:

     

    let
    Source = Json.Document(Web.Contents("https://apisalesdemo4.successfactors.com/odata/v2/User" & "?" & "$format=json", [Headers=[Authorization="Basic XXXXXXXXXXXXXXXXXXXXX"]])),
    #"Converted to Table" = Record.ToTable(Source),
    #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"results", "__next"}, {"Value.results", "Value.__next"})
    in
    #"Expanded Value"

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai

1 Reply

  • v-deddai1-msft's avatar
    v-deddai1-msft
    Community Support

    Hi Anonymous ,

     

    Would you please try to use web data source instead of OData feed? It seems that it will not work when you use odata for SAP SF based on my research.

     

    Would you please try to create a new blank query and use something like:

     

    let
    Source = Json.Document(Web.Contents("https://apisalesdemo4.successfactors.com/odata/v2/User" & "?" & "$format=json", [Headers=[Authorization="Basic XXXXXXXXXXXXXXXXXXXXX"]])),
    #"Converted to Table" = Record.ToTable(Source),
    #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"results", "__next"}, {"Value.results", "Value.__next"})
    in
    #"Expanded Value"

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai