From 731ddc2c0abf867b966ef5846c923372637db303 Mon Sep 17 00:00:00 2001 From: jebba Date: Tue, 25 Jan 2022 14:01:57 -0700 Subject: [PATCH] Add some API scripts --- .gitignore | 1 + README.md | 5 +++++ scripts/pysalx-api-acquire | 11 +++++++++++ scripts/pysalx-api-config | 10 ++++++++++ scripts/pysalx-api-id | 10 ++++++++++ scripts/pysalx-api-status | 10 ++++++++++ scripts/pysalx-api-test | 14 ++++++++++++++ scripts/pysalx-api-wlcalibration | 10 ++++++++++ 8 files changed, 71 insertions(+) create mode 100644 scripts/pysalx-api-acquire create mode 100755 scripts/pysalx-api-config create mode 100755 scripts/pysalx-api-id create mode 100755 scripts/pysalx-api-status create mode 100755 scripts/pysalx-api-test create mode 100755 scripts/pysalx-api-wlcalibration diff --git a/.gitignore b/.gitignore index 0e4b171..afbd543 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .~lock.*# *.swp +output.json diff --git a/README.md b/README.md index eac95b9..9e7a431 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,11 @@ See `./scripts/` directory in this repo for current scripts. Current scripts: +* `pysalx-api-config` --- Get analyzer configuration via API. +* `pysalx-api-id` --- Get analyzer ID via API. +* `pysalx-api-status` --- Get analyzer status via API. +* `pysalx-api-test` --- Do Analyzer test via API. +* `pysalx-api-wlcalibration` --- Get analyzer wavelength calibration via API. * `pysalx-backup-export` --- Backup the export directory, with spectra from templates. * `pysalx-backup-extsd` --- Backup the ext SD card. diff --git a/scripts/pysalx-api-acquire b/scripts/pysalx-api-acquire new file mode 100644 index 0000000..91a24ba --- /dev/null +++ b/scripts/pysalx-api-acquire @@ -0,0 +1,11 @@ +#!/bin/bash +# Acquire a sample via API + +# XXX kruft +SCIAPSIP=`cat ~/.sciaps-ip` +SCIAPSPORT=`cat ~/.sciaps-port` + +#curl -X POST -H "Content-Type: application/json" -d @settings.json --output output.json http://192.168.1.1:8080/api/v2/acquire/all?mode=Alloy + +curl -X POST -H "Content-Type: application/json" -d @settings.json --output output.json http://$SCIAPSIP:$SCIAPSPORT/api/v2/acquire/all?mode=Alloy + diff --git a/scripts/pysalx-api-config b/scripts/pysalx-api-config new file mode 100755 index 0000000..b9eaf3d --- /dev/null +++ b/scripts/pysalx-api-config @@ -0,0 +1,10 @@ +#!/bin/bash +# Get Analyzer Configuration via API + +# XXX kruft +SCIAPSIP=`cat ~/.sciaps-ip` +SCIAPSPORT=`cat ~/.sciaps-port` + +curl \ + http://$SCIAPSIP:$SCIAPSPORT/api/v2/config + diff --git a/scripts/pysalx-api-id b/scripts/pysalx-api-id new file mode 100755 index 0000000..ce2b2b5 --- /dev/null +++ b/scripts/pysalx-api-id @@ -0,0 +1,10 @@ +#!/bin/bash +# Get Analyzer ID via API + +# XXX kruft +SCIAPSIP=`cat ~/.sciaps-ip` +SCIAPSPORT=`cat ~/.sciaps-port` + +curl \ + http://$SCIAPSIP:$SCIAPSPORT/api/v2/id + diff --git a/scripts/pysalx-api-status b/scripts/pysalx-api-status new file mode 100755 index 0000000..07e6ae8 --- /dev/null +++ b/scripts/pysalx-api-status @@ -0,0 +1,10 @@ +#!/bin/bash +# Get Analyzer status via API + +# XXX kruft +SCIAPSIP=`cat ~/.sciaps-ip` +SCIAPSPORT=`cat ~/.sciaps-port` + +curl \ + http://$SCIAPSIP:$SCIAPSPORT/api/v2/status + diff --git a/scripts/pysalx-api-test b/scripts/pysalx-api-test new file mode 100755 index 0000000..7a3e6df --- /dev/null +++ b/scripts/pysalx-api-test @@ -0,0 +1,14 @@ +#!/bin/bash +# Do Analyzer test via API + +# XXX kruft +SCIAPSIP=`cat ~/.sciaps-ip` +SCIAPSPORT=`cat ~/.sciaps-port` + +curl \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{}' \ + --output output.json \ + http://$SCIAPSIP:$SCIAPSPORT/api/v2/test + diff --git a/scripts/pysalx-api-wlcalibration b/scripts/pysalx-api-wlcalibration new file mode 100755 index 0000000..2ff7d8d --- /dev/null +++ b/scripts/pysalx-api-wlcalibration @@ -0,0 +1,10 @@ +#!/bin/bash +# Get Analyzer wavelength calibration via API + +# XXX kruft +SCIAPSIP=`cat ~/.sciaps-ip` +SCIAPSPORT=`cat ~/.sciaps-port` + +curl \ + http://$SCIAPSIP:$SCIAPSPORT/api/v2/wlcalibration +