SDK DocumentationRecipesAnnouncementsSupport Forum
AndroidiOSAnnouncementsSupport Forum
Support Forum

Support Forum

Ask a Question
Back to All

Getting 400 in Native widget request

I am integrating Taboola native widget in my application in a list.
Every third item need to be the Taboola view

  1. I have created a TBLNativePage and TBLNativeUnit instances like this

Note - same properties are used in your sample

val properties = PlacementInfo.widgetProperties()
val nativeTaboolaPage = Taboola.getNativePage(properties.pageType, properties.pageUrl)

val requestData = TBLRequestData().setRecCount(1)
taboolaNativeUnit = nativeTaboolaPage.build(properties.placementName,TaboolaAdProvider.publisherInfo, requestData,
object : TBLNativeListener() {
override fun onItemClick(
placementName: String?,
itemId: String?,
clickUrl: String?,
isOrganic: Boolean,
customData: String?
): Boolean {
println("Taboola | onItemClick | isOrganic = $isOrganic")
return super.onItemClick(placementName, itemId, clickUrl, isOrganic, customData)
}
})

  1. In ViewHolder I have fetched recommendation with this unit

taboolaNativeUnit.fetchRecommendations(object : TBLRecommendationRequestCallback {
override fun onRecommendationsFetched(recommendationsResponse: TBLRecommendationsResponse?) {
// add data to view
}

override fun onRecommendationsFailed(throwable: Throwable?) {
    // Getting 400 Bad Request here
}

})

But I am getting 400 error code in network request with message -
HTTP ERROR 400
Problem accessing /apiHandler/1.2/json/sdk-tester-rnd/recommendations.multiple-get. Reason:
The source.type [article] is not supported

URL -
https://api.taboola.com/1.2/json/sdk-tester-rnd/recommendations.multiple-get?device.id=04af5eac-4ea5-4ada-a69a-132a5dc3adc3&placement1.available=true&ad=%7B%22sdkd%22%3A%7B%22appv%22%3A%225.5.0%22%2C%22appid%22%3A%22com.homepage.news.android.dev%22%2C%22sdkt%22%3A%22Taboola%20Android%20SDK%20-%20API%22%2C%22os%22%3A%22Android%22%2C%22osv%22%3A%2210%22%2C%22sdkv%22%3A%223.5.2%22%2C%22app%22%3A%22HomePage%20News%22%2C%22model%22%3A%22Xiaomi%20POCO%20F1%22%2C%22lng%22%3A%7B%22main%22%3A%22eng%22%2C%22locale%22%3A%22en_IN%22%2C%22dsplng%22%3A%22English%22%2C%22sim%22%3A%22in%22%2C%22netw%22%3A%22in%22%2C%22kbd%22%3A%5B%22%22%5D%7D%2C%22kotlin%22%3Atrue%2C%22androidx%22%3Atrue%2C%22net%22%3A%22wifi%22%2C%22mem%22%3A%225767008%22%2C%22scr%22%3A%7B%22wd%22%3A1080%2C%22ht%22%3A2027%7D%7D%7D&user.opt_out=false&source.id=%2F&app.type=mobile&placement1.name=Widget%20without%20video&source.type=article&req_id=cdb0b553-40f4-41a4-af79-61c00d47142e&source.url=https%3A%2F%2Fblog.taboola.com&app.apikey=c4c6a04f0b48c7992ff477c89a28ef8d41932d12&placement1.organic-type=mix&user.session=v2_ab99edabbcddf419ff23cdf341124161_04af5eac-4ea5-4ada-a69a-132a5dc3adc3_1651576349_1651576349_CNawjgYQ5OxKGL7ihcnu5ZasBSABKAUwZziY0QpA8I8QSIb33ANQod0VWABggwNo_cXPy5zUwd5pcAE&app.name=HomePage%20News&placement1.rec-count=1&placement1.visible=false&view.id=1651578149421

Please let me know what is missing here or where I am creating the wrong request.

Note. For same adapter Classing Widget (XML) is working fine