Permutation API

The API is instantiated by the class Permutation. The class contains methods for each of the API’s features. Further documentation on the API can be found here.

class permutation.Permutation[source]

Instantiate the class to get access to the permutation api. Each feature on the API is provided by a method of this class

find(n: int, r: int, next_variable: str)[source]

Generates permutations based on the given parameters. It sends a JSON payload using the provided params.

Parameters:
  • n – The total number of elements available for permutation

  • r – The number of elements to be selected in each permutation

  • next_variable – The next variable to be included in the permutation

Returns:

Response returns the generated permutation in JSON format.

The response body contains the following information

Parameters:
  • eventId – An event ID assmmociated with the permutation.

  • n – The total number of elements available for permutation.

  • r – The number of elements selected in each permutation.

  • numberOfPermutations – The total number of possible permutations.

  • permutationVariables – An array of arrays, where each inner array represents a permutation with the selected variables.

  • inserted_id – The ID of the inserted permutation.

retrieve(id: str)[source]

Retrieves a specific permutation based on its ID.

Parameters:

id – The inserted id

Returns:

the requested permutation in JSON format.

The response body contains the following information:

Parameters:
  • eventId – An event ID associated with the permutation.

  • n – The total number of elements available for permutation.

  • r – The number of elements selected in each permutation.

  • permutationVariables – An array representing the selected permutation.

  • inserted_id – The ID of the permutation.

save(id: str, selected_permutation: List[str])[source]

Saves a selected permutation. It sends a JSON payload with the parameters provided.

Parameters:
  • id – The ID of the permutation to be saved

  • selected_permutation – An array of variables representing the selected permutation

Returns:

The response confirms the successful saving of the permutation. The response body contains a success message.