Skip to content

Instantly share code, notes, and snippets.

@adamvr
Created March 29, 2012 23:18
Show Gist options
  • Select an option

  • Save adamvr/2244828 to your computer and use it in GitHub Desktop.

Select an option

Save adamvr/2244828 to your computer and use it in GitHub Desktop.
Photonics experiment API description

Location

10.240.132.231:8081

API

GET /WebService/:piezo/:waveform/:amp/:offset/:disc_speed/:laser_current/:focus_point/:filter/:num_avg

where:

  • piezo: piezo in or out. 0 indicates it's out and we're doing a displacement experiment, 1 indicates it's in and that we're doing a velocity experiment.
  • waveform: piezo waveform. Default is sine. Options include:
    • 0: DC, no movement
    • 1: sine
    • 2: square
    • 3: triangle
    • 4: ramp
  • frequency: piezo frequency. Range from 0-100khz. Default is 83hz
  • amp: piezo amplitude. Range from 0-10V peak to peak. Typical is 2V or 5V
  • offset: piezo offset. Possibly unneeded.
  • disc_speed: rotation speed of the disc. Range from 0-1.
  • laser_current: laser current. Range from 0-10mA. Typical is 2.5mA
  • focus_point: focus point of the laser. Default is collimated. Options include:
    • 0: collimated
    • 1: disc
    • 2: piezo
  • filter: laser filters. Default is none. Options include:
    • 0: none
    • 1: 10dB
    • 2: 5dB
    • 3: 3dB
    • 4: 2dB
    • 5: 1dB
  • num_avg: number of averages to take. Range from 1-32. Typical is 4 or 8

Result format

HTTP/1.1 200 OK
Connection: close
Content-Length: 112
Content-Type: text/xml
Date: Fri, 30 Mar 2012 01:48:04 GMT
Server: LabVIEW 8.20/OSX

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
  5K bytes of FFT followed by DF
  10K bytes of time domain followed by DT
</param>
</params>
</methodResponse>

Location

localhost:3000

API

  • GET /experiments - get all experiments
  • POST /experiments - create a new experiment
  • GET /experiments/:id - get an experiment by ID

GET /experiments

  • Returns a list of experiments of the form:

    `[
      { "id": 0,
        "type": "photonics",
        "data": {
          "params": {
            "piezo": "in",
            "waveform": "sine",
            ...
          },
        "result": {
          "fft": [ 5K FFT ],
          "time": [ 10K time]
        }
      }
    },
    { "id": 1,
      "type": "photonics",
      ...
    }
    ]`
    
  • Access unrestricted

POST /experiments

  • Accepts JSON encoded arguments of the form:

    `{"type": "photonics",
      "params": {
        "piezo": "in",
        "waveform": "sine",
        "focus_point": "collimated",
        ...
      }
    }`
    
  • Access limited to known users

  • Returns 201 Created on success with Location header set to the location of the newly created experiment

  • Returns 400 if invalid parameters or experiment type are supplied

GET /experiments/:id

  • Returns a single experiment specified by ID
  • See GET /experiments for format information
  • Returns 404 if the experiment cannot be found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment