Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

sikender/wolfram-tldr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wolfram-tldr

Wolfram Alpha API spews a lot of schematic output. This api is a simple proxy around the Wolfram API.
It extracts the most relevant data from the result and presents it in json or xml formats.

Setup

  • First make sure you have node installed on your system:
  node -v
  • Next clone this repo:
  git clone https://github.com/sikender/wolfram-tldr.git
  • cd into the directory and run npm install to install dependencies.
  • Now head over to Wolfram Alpha API site and sign up for an APPID.
  • Rename the .env.sample file to .env and add the APPID and the PORT you wish to run the server on to it.
  • Done. To run the app just execute:
  npm start

Query

Return the result for your input query as either json or xml.

  • URL

    /api/v1/query

  • Method:

    GET

  • URL Params

    Required:

    input=string

    Optional:

    formal=json|xml

    Defaults to json

  • Success Response:

    • Code: 200
      Content: Depending upon the format parameter

        {
          "input": "When was nelson mendela born?",
          "interpretation": "Nelson Mandela | date of birth",
          "result": "Thursday, July 18, 1918"
        }
      

      or

        <?xml version='1.0'?>
        <result>
          <input>When was nelson mendela born?</input>
          <interpretation>Nelson Mandela | date of birth</interpretation>
          <result>Thursday, July 18, 1918</result>
        </result>
      
  • Error Response:

    • Code: 401 Unauthorized
      Content: Unauthorized

    OR

    • Code: 400 Bad Request
      Content: Bad Request

    OR

    • Code: 500 Internal Server Error
      Content: Internal Server Error
  • Sample Call:

      curl -X GET \
        'http://localhost:8000/api/v1/query?input=When%20was%20nelson%20mendela%20born?&format=xml' \
        -H 'Authorization: Bearer Your-bearer-token'

About

A simple proxy around the wolfram api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published