Hi,
I am trying to use the lite botometer endpoint - I have subscribed to proper subscription plan.
Not sure to understand why I have this (400) error. I have properly extracted user profiles, created an array of 100 x { created_at / user } objects and passed it to the proper url.
See below my code (I have just replaced my api-key):
string postData = J.ToString();
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] encodedPostData = encoding.GetBytes(postData);
var req = WebRequest.Create($"https://botometer-pro.p.rapidapi.com/litev1/check_accounts_in_bulk");
req.Method = "POST";
req.Headers = new WebHeaderCollection() {
{ "x-rapidapi-key", "xxxxxxxxxxxx" },
{ "x-rapidapi-host", "botometer-pro.p.rapidapi.com" },
};
req.ContentType = "application/json";
req.ContentLength = encodedPostData.Length;
Stream stream = req.GetRequestStream();
stream.Write(encodedPostData, 0, encodedPostData.Length);
stream.Close();
using (WebResponse res = req.GetResponse())
{
using (StreamReader sr = new StreamReader(res.GetResponseStream()))
{
var properties = sr.ReadToEnd();
if (!string.IsNullOrEmpty(properties))
{
return JsonConvert.DeserializeObject(properties) as JArray;
}
else
return null;
}
}
Any help would be appreciated …
Thanks!
Приєднуйтесь до обговорення — додайте повідомлення нижче:
Sorry, I’m not familiar with JS. The 400 error suggests that the cause is incorrect payload format. But I can’t be sure based on the code you shared.
We would suggest using our botometer-python package to query the API (https://github.com/IUNetSci/botometer-python). Plus, RapidAPI also provides some example JS code snippets to query the API at https://rapidapi.com/OSoMe/api/botometer-pro , although we haven’t tested these snippets.
–Botometer Team