API

The current API interface is in a VERY rough state. The plan is to proxy requests through API control & analytics services

Currently Algorithmatic.com supports basic RESTful services, returning single JSON object.

On error, all services return a JSON object with an `Error` property. A client should also be able to handle non-JSON errors, such as HTTP 404, 500, or 403.



Search

Definition: search algorithm repository
Action: http://www.algorithmatic.com/api/search/
Notes: all parameters are optional
Parameters:
  • q: search query, with support for Search Operators
  • resultPerPage: number of results to return - current maximum is 20
  • page: page number, use to navigate to the next set of results, starts/defaults to 1
  • properties: You can use this to restrict the attribute names returned by a search, by specifying only the properties that you will use. If not specified, all details will be returned. See below for concrete examples.

Example Output
// URL: http://www.algorithmatic.com/api/search/?q=tag:cryptography
{
  "TotalCount": 2,
  "Sorting": "top-rated",
  "Timeframe": "all-time",
  "Result": [
    {
      "AlgorithmId": 42,
      "Version": 1,
      "Name": "Caesars Cipher",
      "PragmaticName": "CaesarsCipher",
      "Description": "In cryptography, a Caesar cip...",
      "DateCreated": "\/Date(1241846412000+0300)\/",
      "User": "ANaimi",
      "Rank": 1,
      "Views": 1,
      "LastActivity": "\/Date(1259603505977+0300)\/",
      "Tags": "Cryptography",
      "FavoriteCount": 0,
      "ImplementationsAvailable": 1,
      "Url": "/algorithm/42/version-1/caesars-cipher/"
    },
    {
      "AlgorithmId": 43,
      "Version": 1,
      "Name": "RSA",
      "PragmaticName": "RSA",
      "Description": "RSA is an asymmetric ...",
      "DateCreated": "\/Date(1259603491303+0300)\/",
      "User": "ANaimi",
      "Rank": 1,
      "Views": 1,
      "LastActivity": "\/Date(1259603627647+0300)\/",
      "Tags": "Cryptography, DigitalSignature",
      "FavoriteCount": 1,
      "ImplementationsAvailable": 1,
      "Url": "/algorithm/43/version-1/rsa/"
    }
  ]
}
// Specifying properties to reduce redundant output
// URL: http://www.algorithmatic.com/api/search/?q=tag:cryptography&properties=AlgorithmId,Version,Name
{
  "TotalCount": 2,
  "Sorting": "top-rated",
  "Timeframe": "all-time",
  "Result": [
    {
      "AlgorithmId": 42,
      "Version": 1,
      "Name": "Caesars Cipher",
    },
    {
      "AlgorithmId": 43,
      "Version": 1,
      "Name": "RSA",
    }
  ]
}

Algorithm

Definition: returns the details of a specified algorithm
Action: http://www.algorithmatic.com/api/algorithm/
Notes: a request should provide either `algorithmId` with `version` or `algorithmPragmaticName` with `version`
Parameters:
  • algorithmId: id (number) of the algorithm
  • algorithmPragmaticName: the pragmatic name of the algorithm (CamelCased, alpha-num)
  • version: version number of the implementation
  • properties: same as properties in Search - use to specify details and eliminate redundant info

Example Output
// URL: http://www.algorithmatic.com/api/algorithm/?algorithmId=11&version=4
{
  "AlgorithmId": 11,
  "Version": 4,
  "Name": "Binary Search",
  "PragmaticName": "BinarySearch",
  "Description": "In computer science, a ...",
  "DateCreated": "\/Date(1247759099000+0300)\/",
  "User": "ANaimi",
  "Rank": 1,
  "Views": 11,
  "LastActivity": "\/Date(1251466180453+0300)\/",
  "Tags": "Search, ComputerScience",
  "FavoriteCount": 1,
  "Script": "Ly8gcmVhZCBpbnB1dCBmcm... base64 string",
  "Url": "/algorithm/11/version-4/binary-search/"
}
// Specifying properties to reduce redundant output
// URL: http://www.algorithmatic.com/api/algorithm/?algorithmId=11&version=4&properties=Name,Description
{
  "Name": "Binary Search",
  "Description": "In computer science, a binary sea..."
}

Tags

Definition: returns the tags in repository containing the specified tag name (max 20 results)
Action: http://www.algorithmatic.com/api/tags/
Notes: not specifying tag name will return the most popular tags
Parameters:
  • tagName: tag name to search for

Versions

Definition: returns the different implementations of a specified algorithm
Action: http://www.algorithmatic.com/api/versions/
Notes: one of the parameters must be provided in the request
Parameters:
  • algorithmId: id (number) of the algorithm
  • algorithmPragmaticName: the pragmatic name of the algorithm (CamelCased, alpha-num)

updated 3 months and 2 weeks ago by guest