Botometer Pro

FREEMIUM
От Observatory on Social Media | Обновлено hace 23 días | Social
Популярность

9.3 / 10

Задержка

1,126ms

Уровень обслуживания

100%

Health Check

N/A

Назад ко всем обсуждениям

The remote server returned an error: (400) Bad Request.

Rapid account: Olivier Dellenbach
olivier.dellenbach
hace 2 años

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!

Rapid account: O So Me
OSoMe Commented hace 2 años

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

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии