400 Bad Request for v2 GET user API

<html>

<head>
	<title>400 Bad Request</title>
</head>

<body>
	<center>
		<h1>400 Bad Request</h1>
	</center>
</body>

</html>

I am trying to retrieve user information via Postman. I have supplied the given Bearer token, and given a valid user ID. I’ve also set the content-type to be application/json as well.

This should already work, but instead I keep getting a 400 error and I really don’t know where the issue is lying.

https://api.freshchat.com/v2/users This is the correct API to pass the user ID, is it not?

Hi @Nazisagit,

Could you share what is the URL and method used?

Hi @Raviraj Freshchat I used the GET request.

I am also having an issue with the update user details request in my code. I keep receiving a 400 even when I have given the necessary headers (Accept, Auth, Content-Type). Do I need to explicitly pass the Host in the Headers as well?

1 Like

@Nazisagit Can you provide me with the user id you are using? Ideally, the UUID is generated by Freshchat and it cannot be an email or externalId that is being set on Freshchat.

The Endpoint https://api.freshchat.com/v2/users/<User UUID> can be used to retrieve user details, but if you don’t have the UUID, you can search for it based on email or externalId using the below endpoint.

https://api.freshchat.com/v2/users?reference_id=<User ExternalId>

The supported filters for the above API are first_name, last_name, email, phone_no and reference_id.

Let me know if this works for you.

1 Like

@Arjun_Paliath @Raviraj found the issue, it was with Ruby itself.

{ "Content-Type": "application/json" }

does not set the content-type correctly. All I needed to do was

{ "Content-Type" => "application/json" }
2 Likes