<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00007Yqav0CABOkta Classic EngineAPI Access ManagementAnswered2022-04-18T23:06:00.000Z2022-04-11T05:00:26.000Z2022-04-18T23:06:00.000Z

WillS.48217 (Customer) asked a question.

Unknown HTTP Error when activating user via API

I am programmatically creating and activating users by hitting the /api/v1/users endpoint. I create the user with the activate parameter set to false. The, I am hitting the /api/v1/users/${userId}/lifecycle/activate endpoint with the sendEmail parameter set to true. In my program, I get an error response from the second request, with an unknown error. The error is as follows:

 

"Http failure response for https://{{url}}/api/v1/users/{{user_id}}/lifecycle/activate?sendEmail=true: 0 Unknown Error"

 

When I hit the same activation endpoint in Postman after this, I do not get an error and it work as I expect. How should I resolve this? Let me know if I need to add more detail or clarify anything,


  • WillS.48217 (Customer)

    Status result 0 usually means that there was no response or that the connection is too slow. If this error comes up, it can be work checking the code you are using to make the API call for mistakes. In my case that prompted this question, I was not correctly adding the body to my request in TypeScript.

    Selected as Best
  • Mihai N. (Okta, Inc.)

    Hi @WillS.48217 (Customer)​ , Thank you for reaching out to the Okta Community!

     

    I'm not completely sure this is the root cause, but just eyeballing it ... it should say userId not user_id .

     

    Hope it helps! :D

     

    Expand Post
    • WillS.48217 (Customer)

      That was just the variable used in my string formatting in my application making the request. It should not have any effect on the HTTP request being made.

      • Mihai N. (Okta, Inc.)

        Understood. 

         

        I pulled up the API error codes list (https://developer.okta.com/docs/reference/error-codes/) and there's no mention of "0 Unknown Error".

         

        Would have expected

         

        E0000001: API validation exception

        HTTP Status: 400 Bad Request

         

        or (seeing as you do it programmatically)

         

        E0000047: Too many requests exception

        HTTP Status: 429 Too Many Requests

         

        You already ruled out typos, and confirmed that the same thing works fine in POSTMAN. This leaves me thinking it might be something wrong with your program.

         

        Maybe someone else on the Community encountered this and can shed some light.

         

        Also try https://devforum.okta.com/ , they are more likely to have come across this.

        Expand Post
  • WillS.48217 (Customer)

    Status result 0 usually means that there was no response or that the connection is too slow. If this error comes up, it can be work checking the code you are using to make the API call for mistakes. In my case that prompted this question, I was not correctly adding the body to my request in TypeScript.

    Selected as Best
This question is closed.
Loading
Unknown HTTP Error when activating user via API