Array Sort

Sort Array Endpoint

The Sort Array endpoint allows you to sort an array of numbers either in ascending or descending order. You can specify the sort order by passing the sort query parameter with values of high or low.

Endpoint

URL: https://api.erensko.xyz/v1/sort-array Method: POST Description: Sorts an array of numbers based on the specified sort order. You can choose to sort the array in descending (high) or ascending (low) order.

URL Parameters

Key
Value

sort

The order in which your array should be sorted. highSorts the array in descending order (from highest to lowest). low Sorts the array in ascending order (from lowest to highest).

Body

Key
Value

array

The array of numbers you would to sort.

Headers

Key
Value

Authorization

Your own personal API key, create one by clicking here. This is required.

Request Example

POST https://api.erensko.xyz/v1/sort-array?sort=high

{
  "array": [300, 100, 200]
}

Response Example

For ?sort=high (descending order):

{
  "result": [3, 2, 1],
  "description": "Array sorted in descending order.",
  "originalArray": [1, 2, 3],
  "timestamp": "2023-10-25T12:34:56.789Z",
  "isValid": true,
  "sortMethod": "High to Low"
}

For ?sort=low (ascending order):

{
  "result": [100, 200, 300],
  "description": "Array sorted in ascending order.",
  "originalArray": [300, 100, 200],
  "timestamp": "2023-10-25T12:34:56.789Z",
  "isValid": true,
  "sortMethod": "Low to High"
}

Last updated