Linkedin Company Data

FREEMIUM
От William Barber | Обновлено 15 days ago | Social
Популярность

9.8 / 10

Задержка

3,021ms

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

95%

Health Check

100%

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

Bad Request: There was an error parsing the input (400)

Rapid account: Luke Wilson Storm
LukeWilsonStorm
3 months ago

I’m using the code as given to look up company data, but I’m getting an error if I use it anywhere except on this page to test the endpoint.

What am I doing wrong?

This is the result I get:

{"message":"Bad Request: There was an error parsing the input","status_code":400}

const url = 'https://linkedin-company-data.p.rapidapi.com/linkedInCompanyDataJson';
const options = {
	method: 'POST',
	headers: {
		'content-type': 'application/json',
		'X-RapidAPI-Key': 'API_KEY',
		'X-RapidAPI-Host': 'linkedin-company-data.p.rapidapi.com'
	},
	body: {
		liUrls: [
	'https://www.linkedin.com/company/hilton/'
		]
	}
};

try {
	const response = await fetch(url, options);
	const result = await response.text();
	console.log(result);
} catch (error) {
	console.error(error);
}
Rapid account: Luke Wilson Storm
LukeWilsonStorm Commented 3 months ago

Could be useful to have something on the “Tutorials” page maybe, as there’s nothing there currently.

Rapid account: Williambarberjr
williambarberjr Commented 3 months ago

Yeah, thanks for the heads up, that’s good to know. I don’t think I have the ability to change that code as it’s auto generated by the platform unfortunately but I’ll look into it.

Rapid account: Luke Wilson Storm
LukeWilsonStorm Commented 3 months ago

Thanks that worked!

But FYI, that isn’t included or mentioned in the code you can copy from here

Rapid account: Williambarberjr
williambarberjr Commented 3 months ago

You forgot JSON.stringify() around the body:

JSON.stringify({
liUrls: [
https://www.linkedin.com/company/hilton/
]
})

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

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