0

I am facing issues while creating an Okta app via Okta APIs.

I followed this documentation to create an app with the following:

headers = {
  'Accept': 'application/json',
            'Authorization': 'SSWS '+api_token,
            'Content-Type': 'application/json'
}

input = {"name": tenant_name, "label": "Sample tenant App", "signOnMode": "OPENID_CONNECT",   
}

response = requests.post(url, headers=headers, json=input)
url: https://dev-231233.oktapreview.com/api/v1/apps (example)

But I am getting following error:

{'errorCode': 'E0000007', 'errorSummary': 'Not found: Resource not found: test-tenant (App)', 'errorLink': 'E0000007', 'errorId': 'oaedyrTOkwESTSg7_A8nXrCxg', 'errorCauses': []}

I am wondering that I am trying to create an app and this API call is trying to find that app, is anything missing in the request params?

I also tried the python SDK https://github.com/okta/okta-sdk-python but I am getting errors wrt python 3.7 . Looks like it is not maintained recently.

I would appreciate any help with code samples to create an APP using Okta APIs?

Ishita Shah
  • 3,955
  • 2
  • 27
  • 51
kalakaar
  • 121
  • 1
  • 1
  • 8

1 Answers1

0

I think the problem is that the name field is NOT a display value, it is a key for the type of application: https://developer.okta.com/docs/api/resources/apps#app-names--settings

Use label for your human-readable value.

Brian Demers
  • 2,051
  • 1
  • 9
  • 12
  • Thanks @Brian Demers for your answer. I tried: input = {"name": "template_basic_auth", "label": "Test Web", "signOnMode": "OPENID_CONNECT", "settings": { "app": { "requestIntegration": False, "url": "localhost:8080/";, "authURL": "localhost:8080"; } } } . but get an error . { [{'errorSummary': 'Cannot create application instance. Maximum number of instances has been reached.'}]}. However I am able to create an app from the GUI, any restrictions on API side? What is the reason for this error – kalakaar Oct 02 '18 at 18:11
  • Here is the complete error: {'errorCode': 'E0000001', 'errorSummary': 'Api validation failed: generalSettings', 'errorLink': 'E0000001', 'errorId': 'oae2hOfNjfcTGqUdY1ngXpmLQ', 'errorCauses': [{'errorSummary': 'Cannot create application instance. Maximum number of instances has been reached.'}]} – kalakaar Oct 02 '18 at 18:36
  • IIRC, you get five free, if you delete one does the API allow you to create another? – Brian Demers Oct 03 '18 at 19:55
  • I have a paid account. Do you have code samples available somewhere? – kalakaar Oct 04 '18 at 16:23
  • Take a look at our Postman collections: https://developer.okta.com/reference/postman_collections/ – Brian Demers Oct 05 '18 at 19:33
  • Thanks. I already tried that but get the same error: { "errorCode": "E0000001", "errorSummary": "Api validation failed: generalSettings", "errorLink": "E0000001", "errorId": "oaeMpcUyrB-QDOXnt1fxiKOBg", "errorCauses": [ { "errorSummary": "Cannot create application instance. Maximum number of instances has been reached." } ] } QUESTION: Does Okta has some issues in creating applications via API from python code? Can you please confirm? – kalakaar Oct 05 '18 at 20:21
  • The client language wouldn't matter. Can you update the post with the message body you are using? I'll try it out. – Brian Demers Oct 08 '18 at 16:18
  • 1
    Thanks @Brian Demers. I am able to create apps via python code. The main culprit was the label field and on some dev accounts I was not able to call APIs using a token. this is resolved now. – kalakaar Oct 11 '18 at 21:43