404 Not Found response from the Management API

Hi There,

Been trying to get some Management API calls to work, but I keep getting the following error:

“Server returned: 404 Not Found”

I am trying to update a user with the following link:

https://dev-p2gisi3l38iiryqg.us.auth0.com/api/v2/users/auth0|6494bb02f1ac1401362d9cca

Sending the following data:

{ “given_name”: “Hebster”, “family_name”: “Reynolds”, “name”: “Hebster Reynolds” }

And I keep getting the following response:

Server returned: 404 Not Found

Not sure if my post values are even getting passed to the link. I’ve sent the token, and all requested json details. Not sure how to fix.

Any suggestions on where I should look to correct the error?

Hi @heberr1,

Welcome to the Auth0 Community!

I have just checked your tenant logs and it seems that you were able to successfully update the user. I couldn’t find any logs indicating a failed event.

However, I have attached a code snippet that worked for me to update a user using the Management API. Could you please give it a try and see if it works for you?

const axios = require('axios');
let data = JSON.stringify({
  "email": "test-user@example.com",
  "given_name": "test-given-name",
  "family_name": "test-family-name",
  "name": "test-name"
});

let config = {
  method: 'patch',
  maxBodyLength: Infinity,
  url: 'https://YOUR_DOMAIN.REGION.auth0.com/api/v2/users/{USER_ID}',
  headers: { 
    'Authorization': 'Bearer {YOUR_MANAGEMENT_API_TOKEN}', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

If you are still encountering issues, could you please share the exact steps and code you used?

I look forward to your update.

Thanks,
Rueben

Hi Rueben,

Thank you for your quick response. Same error message.

Here is the link I am testing with:

https://register.theaub.org/updateuser.asp

I am using classic asp as far as coding is concerned. I can see that your code is JavaScript maybe I should switch to JavaScript for this purpose.

Below is a code I am using right now:

<%
Function CreateJSon()

	Set oJSON = New aspJSON

	With oJSON.data
		.Add "email", "hebster@msn.com"
		.Add "given_name", "Hebster"
		.Add "family_name", "Reynolds"
		.Add "name", "Hebster Reynolds"
	End With

	CreateJSon = oJSON.JSONoutput()  'Return json string

End Function

'---- Update User —

Dim http: Set http = Server.CreateObject(“WinHttp.WinHttpRequest.5.1”)

Dim url: url = “https://dev-p2gisi3l38iiryqg.us.auth0.com/api/v2/users/ {USER_ID}”
Dim data: data = CreateJSon()

With http
Call .Open(“POST”, url, False)
Call .SetRequestHeader(“Authorization”, “Bearer {YOUR_MANAGEMENT_API_TOKEN}”)
Call .SetRequestHeader(“Content-Type”, “application/json”)
Call .Send(data)
End With

Response.write “
url=” & url & “

Response.write “
Data=” & data & “

Response.write “
http.Status=” & http.Status & “

If Left(http.Status, 1) = 2 Then
'Request succeeded with a HTTP 2xx response, do something…
Else
'Output error
Call Response.Write("Server returned: " & http.Status & " " & http.StatusText)
End If

%>

Thank again for your response.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.