Can't create a new user using REST API | Community
Skip to main content
Answered

Can't create a new user using REST API

  • November 19, 2024
  • 1 reply
  • 141 views

Hello!

I am trying to create a user by using the API endpoint described here:
https://developers.intercom.com/docs/references/1.0/rest-api/users/create-or-update-user

This is the cURL that I am using:
 

curl -X POST https://api.intercom.io/users -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -d '{"user_id":"3ba5cb8d-8d66-4887-8d1b-4a9b66031f90"}'

It throws this error: 

{
  "errors": [
    {
      "code": "media_type_not_acceptable",
      "message": "The Accept header should send a media type of application/json"
    }
  ],
  "type": "error.list"
}

After that, I add the Accept header and now I get this error no matter what I send:

curl -X POST https://api.intercom.io/users -H "Authorization: Bearer <token>" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"id":"3ba5cb8d-8d66-4887-8d1b-4a9b66031f90","user_id":"3ba5cb8d-8d66-4887-8d1b-4a9b66031f90"}'

 

{
    "errors": [
        {
            "code": "not_found",
            "message": "The requested resource does not exist; check your path and try again"
        }
    ],
    "type": "error.list"
}

The docs clearly state: 

Users not found via email or user_id will be created, and those that are found will be updated.

Best answer by Jacques Reynolds

Hey โ€‹@Mukhammed Kairatuly ๐Ÿ‘‹ Jacques here from Support Engineering.

The error youโ€™re getting is because the /users endpoint has been deprecated. media_type_not_acceptable indicates the Accept header was missing or incorrect. not_found indicates the /users endpoint is no longer available or valid for the latest Intercom API version.

You can use the Update a contact and create a contact endpoints instead!

Hope this helps! 

 

View original
Did this topic help you find an answer to your question?

1 reply

Jacques Reynolds
Intercom Team
Forum|alt.badge.img+7

Hey โ€‹@Mukhammed Kairatuly ๐Ÿ‘‹ Jacques here from Support Engineering.

The error youโ€™re getting is because the /users endpoint has been deprecated. media_type_not_acceptable indicates the Accept header was missing or incorrect. not_found indicates the /users endpoint is no longer available or valid for the latest Intercom API version.

You can use the Update a contact and create a contact endpoints instead!

Hope this helps! 

 


Reply