Skip to content

Add Avatar Image on Sign Up #208

@HelenGezahegn

Description

@HelenGezahegn

Problem
When creating a new user and calling the https://api.chatengine.io/users/ api, I want to send in the avatar image. I've tried to send it as avatar (sends an error) and avatarUrl (no error but avatar image not updated), but it doesn't get set.

This is my current API call:

outer.post("/signUp", async (req, res) => {
  try {
    const { username, password, avatar } = req.body;

    const chatEngineResponse = await axios.post(
      "https://api.chatengine.io/users/",
      {
        username: username,
        secret: password,
        avatarUrl: avatar // How do I pass in the avatar image url properly?
      },
      {
        headers: { "Private-Key": process.env.PRIVATE_KEY }
      }
    );

    res.status(200).json({ response: chatEngineResponse.data });
  } catch (error) {
    console.error("Error", error.message);
    res.status(500).json({ error: error.message });
  }
});

Question
How do I pass in the avatar image url properly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions