cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BhavikaVala
Regular Visitor

Use Bing news in power app

Hello All,

I have added the Bing Serch connector in PowerApps and trying to use it(BingSearch.GetNews("Corona", {count: 50})). But having a below error. Please help me out with this.

BingSearch.GetNews failed: { "message": "The
message body is not a valid JSON. Unexpected
character encountered while parsing value:
\u001b. Path '', line 0, position 0.\r\n at
Newtonsoft.Json.JsonTextReader.ParseValue()\r\n
at Newtonsoft.Json.Linq.JObject.Load(JsonReader
reader, JsonLoadSettings settings)\r\n at
Microsoft.WindowsAzure.ApiManagement.Proxy.G
stream, Encoding encoding, JsonSerializerSettings
settings)\r\n at
Microsoft.WindowsAzure.ApiManagement.Proxy.G
(Boolean preserveContent)"}

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @BhavikaVala :

I did the same test and encountered the problem you mentioned.

Firstly, I guess the reason is that PowerApps seems can not recognize the message body of BingSearch.GetNews ().

So you could not directly use PowerApps to get the news list.

message body(fieldname)

 

[
  {
    "name": "XXXX",
    "url": "https://www.reuters.com/article/XXXXXXXX",
    "image": {
      "thumbnail": {
        "contentUrl": "https://www.bing.com/th?id=ON.DB0E833XXXXXX",
        "width": 700,
        "height": 490
      }
    },
……]

 

PowerApps required format(fieldname)

 

[
  {
    ‘name’: "XXXX",
    ‘url’: "https://www.reuters.com/article/XXXXXXXX",
    ‘image’: {
      ‘thumbnail’: {
        ‘contentUrl’: "https://www.bing.com/th?id=ON.DB0E833XXXXXX",
        ‘width’: 700,
        ‘height’: 490
      }
    },
……]

 

Secondly, the good news is that PowerApps can recognize the data after Flow analysis.

Here is my solution:

1\Create a new flow('PowerApp->Listnewsbyquery')

Action-Power Automate-Create a new flow

 

Response Body JSON Schema:

 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "url": {
                "type": "string"
            },
            "image": {
                "type": "object",
                "properties": {
                    "thumbnail": {
                        "type": "object",
                        "properties": {
                            "contentUrl": {
                                "type": "string"
                            },
                            "width": {
                                "type": "integer"
                            },
                            "height": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "description": {
                "type": "string"
            },
            "provider": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "_type": {
                            "type": "string"
                        },
                        "name": {
                            "type": "string"
                        },
                        "image": {
                            "type": "object",
                            "properties": {
                                "thumbnail": {
                                    "type": "object",
                                    "properties": {
                                        "contentUrl": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "required": [
                        "_type",
                        "name",
                        "image"
                    ]
                }
            },
            "datePublished": {
                "type": "string"
            },
            "category": {
                "type": "string"
            },
            "about": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "readLink": {
                            "type": "string"
                        },
                        "name": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "readLink",
                        "name"
                    ]
                }
            }
        },
        "required": [
            "name",
            "url",
            "description",
            "provider",
            "datePublished"
        ]
    }
}

 

2\Add a button set its OnSelect Property to:

 

ClearCollect(VarVar,'PowerApp->Listnewsbyquery'.Run("Corona"))   /*VarVar is my custom collection*/

 

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @BhavikaVala :

I did the same test and encountered the problem you mentioned.

Firstly, I guess the reason is that PowerApps seems can not recognize the message body of BingSearch.GetNews ().

So you could not directly use PowerApps to get the news list.

message body(fieldname)

 

[
  {
    "name": "XXXX",
    "url": "https://www.reuters.com/article/XXXXXXXX",
    "image": {
      "thumbnail": {
        "contentUrl": "https://www.bing.com/th?id=ON.DB0E833XXXXXX",
        "width": 700,
        "height": 490
      }
    },
……]

 

PowerApps required format(fieldname)

 

[
  {
    ‘name’: "XXXX",
    ‘url’: "https://www.reuters.com/article/XXXXXXXX",
    ‘image’: {
      ‘thumbnail’: {
        ‘contentUrl’: "https://www.bing.com/th?id=ON.DB0E833XXXXXX",
        ‘width’: 700,
        ‘height’: 490
      }
    },
……]

 

Secondly, the good news is that PowerApps can recognize the data after Flow analysis.

Here is my solution:

1\Create a new flow('PowerApp->Listnewsbyquery')

Action-Power Automate-Create a new flow

 

Response Body JSON Schema:

 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "url": {
                "type": "string"
            },
            "image": {
                "type": "object",
                "properties": {
                    "thumbnail": {
                        "type": "object",
                        "properties": {
                            "contentUrl": {
                                "type": "string"
                            },
                            "width": {
                                "type": "integer"
                            },
                            "height": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "description": {
                "type": "string"
            },
            "provider": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "_type": {
                            "type": "string"
                        },
                        "name": {
                            "type": "string"
                        },
                        "image": {
                            "type": "object",
                            "properties": {
                                "thumbnail": {
                                    "type": "object",
                                    "properties": {
                                        "contentUrl": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "required": [
                        "_type",
                        "name",
                        "image"
                    ]
                }
            },
            "datePublished": {
                "type": "string"
            },
            "category": {
                "type": "string"
            },
            "about": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "readLink": {
                            "type": "string"
                        },
                        "name": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "readLink",
                        "name"
                    ]
                }
            }
        },
        "required": [
            "name",
            "url",
            "description",
            "provider",
            "datePublished"
        ]
    }
}

 

2\Add a button set its OnSelect Property to:

 

ClearCollect(VarVar,'PowerApp->Listnewsbyquery'.Run("Corona"))   /*VarVar is my custom collection*/

 

 

Best Regards,

Bof

View solution in original post

Thank you so much @v-bofeng-msft for your time and help.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,222)