Creating multiple ePSK via API

CnMaestro Cloud APIs have a quite restricted API rate limit (not clear how much, but we get frequent errors).
While is possible to delete multiple PSK in one call, it is not obvious form the API doc how to add multiple ePSK in one API call - which could be a way to reduce the rate of API calls.

I am referring to this method:
that accepts this body:

  "count": 1,
  "mac": "00:00:00:FF:FF:FF",
  "passphrase": "Password123$%^",
  "passphrase_strength": "strong",
  "username": "Lab_laptop",
  "vlan": "20-25"

How can we add multiple ePSK in one single call?
What does it mean the parameter “count”?
Why in the example the value for “vlan” is an interval “20-25” ? > If I pass an interval “2000-4000” what will cnMestro assign to this user?

Ref API docs:

one can create upto 2000 ePSK’s from 6.4.2 version onwards on XV and XE series APs.

  "count": 2000,
  "passphrase_strength": "strong",
  "username": "Lab_laptop",
  "vlan": "20"

Mac and Passphrase option is provided to create individual ePSKs.
Please check the “schema” option available near the Example body which will explain the mandatory parameters for any API call.

Attaching the ePSK schema screenshot

Thanks for your help.
This method, however, doesn’t allows to create in one single call multiple custom psks.
My goal is to create multiple psks where for each one I specify username, passphrase and vlan.

The only reason for this is to overcome API rate limits that can cause problems and are difficult to handle.
But I don’t see any other solution.

Could you please clarify why incremental usernames aren’t sufficient? Just wanted to understand the use case .

Here is the use case so you can grasp better the problem.

An external portal allows administrators to provision ePSK into cnMaestro. The portal automatically assigns a different VLAN to each user (tenants of an MDU).

If the admin of this portal has to activate multiple users in a short time, it is very likely that the APIs will hit the rate limit. So, one possible solution is to schedule PSK activation on a periodic base (such as once per hour) and create multiple of them in one single API call.
Also, the portal automatically assigns an initial default passphrase to each user (their phone number), that users have to change.

Now, in this case, each PSK provisioned in cnMaestro via API needs to be entered with a specific VLAN and passphrase (the username does not matter really).

So what would be ideal, really, is to pass an array to the API body, such as:

  "count": 1,
  "passphrase": "4156234567",
  "username": "tenant1",
  "vlan": "1"
  "count": 1,
  "passphrase": "4156234566",
  "username": "tenant2",
  "vlan": "2"

Or a similar functionality.

In the alternative, we need to understand better API rate limits and handle them properly relying on the header response.

1 Like

Thanks Ivan, understood the usage now.

@Anandakrishnan any update on this area?
I still very frequently get 503 errors reporting “The requested resource is being edited by another user and is locked”. Is there a way to get around this limitation?