diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..b6760fd --- /dev/null +++ b/docs/404.html @@ -0,0 +1,443 @@ + + + +
+ + + + + + + + + + + + +This document will walk you through the setup and configuration of a development environment for webqueue2 using the provided development machines, SSH authentication, GitHub and VS Code.
+Note
+These are already installed on the provided development machines.
+We will be using SSH keys to authenticate to both the development machines and GitHub.
+In either PowerShell on Windows or bash on macOS/Linux, run the following command and accept all defaults by pressing Enter: +
ssh-keygen
+
id_rsa
and id_rsa.pub
in the .ssh
folder inside your user's folder. Your user's folder can usually be found at:
+C:\Users\<user_name>
+
/Users/<user_name>
+
/home/<user_name>
+
Note
+Most CLI shells like PowerShell and bash use the ~ (tilda) key as a shortcut for your user's folder.
+You can confirm these files were created by running: +
ls ~/.ssh/
+
In your editor of choice, create the file ~/.ssh/config
and add this:
Tip
+Replace campb303
with your career account username and replace w2vm1
with the name of the provided development machine you're connecting to.
Host campb303-w2vm1
+ HostName w2vm1.ecn.purdue.edu
+ User campb303
+ # Forward Flask Debug Port
+ LocalForward 5000 localhost:5000
+ # Forward MkDocs Port
+ LocalForward 5000 localhost:6060
+ # Forward gunicorn Port
+ LocalForward 8000 localhost:8000
+
The configuration above will allow you to connect to the development machine and automatically forward ports for development tools to work. Here's a bit more detail about what's going on:
+Key | +Value | +
---|---|
Host | +A friendly name to identify an SSH host by. This can be anything. | +
HostName | +The DNS name or IP address of the computer you're connecting to. | +
User | +The name of your user on the computer you're connecting to. | +
LocalForward | +Forwards a port on your computer to a port on the computer you're connecting to. | +
Development machines are not publicly accessible. You'll need to be connected to WebVPN to connect to them.
+WebVPN works on all platforms but requires an extra step to get to work. On macOS/Linux, pier.ecn.purdue.edu
can be used as an SSH jump host allowing for development machines to be connected to automatically when openning VS Code.
Assuming you already have an SSH key configured for pier.ecn.purdue.edu
, you can use a jump host by adding the following to ~/.ssh/config
:
Host campb303-pier
+ HostName pier.ecn.purdue.edu
+ User campb303
+
+Host campb303-w2vm1
+ HostName w2vm1.ecn.purdue.edu
+ ProxyJump campb303-pier
+ User campb303
+ # Forward Flask Debug Port
+ LocalForward 5000 localhost:5000
+ # Forward MkDocs Port
+ LocalForward 5000 localhost:6060
+ # Forward gunicorn Port
+ LocalForward 8000 localhost:8000
+
To test your configuration, run ssh
followed by the Host
value. When prompted for your password, enter your career account password and press Enter.
Warning
+Most shell environemnts like PowerShell and bash do not show your password being typed but it is being typed.
+For the configuration above you would run:
+ssh campb303-w2vm1
+campb303@w2vm1's password:
+
Now that we've generated SSH keys and configured our host entries, we need to add our SSH key to the host. This will allow us to connect to these machines without passwords later.
+Tip
+Replace HOST
below with the value from above. Example: campb303-w2vm1
type $env:USERPROFILE\.ssh\id_rsa.pub | ssh HOST "cat >> .ssh/authorized_keys"
+
ssh-copy-id HOST
+
If the key was added successfully, you can login without entering a password by running: +
ssh HOST
+
Download and install VS Code. Be sure to add code
to your PATH.
Adding code
to your PATH on Windows is a checkbox in the installer:
Image from this article on Techomoro
+Adding code
to your PATH on macOS/Linux is accessible by searching for "PATH" in the Command Pallete. You can access the Command Pallete with the keyboard shortcut Command/Ctrl + Shift + P:
Image from this StackOverflow thread
+Install the Remote - SSH plugin. After installation a new icon will appear in the sidebar:
+Note
+This may take a couple of minutes on the first connection while VS Code installs its server.
+If prompted for a platform, select Linux:
+
Because the development machine will be the computer that connects to GitHub, we need to create another SSH key and add it to our GitHub profile:
+First, open VS Code's integrated terminal by pressing Control + ~ (tilda)
+Now run the following command and accept all defaults by pressing Enter: +
ssh-keygen
+
This will create the files id_rsa
and id_rsa.pub
in ~/.ssh/
. You can confirm this by running:
+
ls ~/.ssh/
+
Now copy the public key from id_rsa.pub
by openning the file in VS Code, selecting its contents and copying it. You can open the file in VS Code by running the following in the integrated terminal:
Danger
+Do not copy your private key from id_rsa
! This key should never leave your machine.
code ~/.ssh/id_rsa.pub
+
Now go to github.itap.purdue.edu/settings/keys. You may be prompted to login using your career account username and password.
+id_rsa.pub
into the key boxUsing the integrated terminal in VS Code, run: +
git clone git@github.itap.purdue.edu:ECN/webqueue2-api.git
+
webqueue2-api
folder in your user's home directory. Open this directory using the "Open Folder" button:
+Note
+VS Code will automatically reconnect to the last remote host used when it reopens.
+Tip
+If you need to reconnect manually, there will now be an option to open the webqueue2-api folder directly from the Remote Hosts menu:
+The Python extension supports virtual environments but needs to be told where the virtual environment is.
+Create or modify the file .vscode/settings.json
and add the following:
+
"python.defaultInterpreterPath": "./venv/bin/python3"
+
Tip
+The Python extension may complain and tell you to select another interpreter. Ignore this warning for now.
+For consistentcy, we'll use a docstring template. Create or modify the file .vscode/settings.json
and add the following:
+
"autoDocstring.customTemplatePath": "./docstring-format.mustache"
+
At this point, your .vscode/settings.json
file should look like this:
+
{
+ "python.pythonPath": "./venv/bin/python3",
+ "autoDocstring.customTemplatePath": "./docstring-format.mustache"
+}
+
For development, we'll use a Python Virtual Environment to isolate out changes and have a reproducible dev environment.
+In VS Code's integrated terminal:
+Create a virtual environment at ./venv/
:
+
python3 -m venv venv
+
Activate the virtual environment: +
source venv/bin/activate
+
Tip
+To deactivate the virtual environment and use your system's Python interpreter, run:
+deactivate
+
Update pip within the virtual environment: +
pip install -U pip
+
Install the webqueue2 API within the virtual environemt: +
pip install -e .[all]
+
-e
installs a package in editable mode which allows code changes to take effect without reinstalling a package.
webqueue2 API has multiple conditional dependencies:
+Condition | +Installation Command | +Description | +
---|---|---|
Production | +pip install . |
+For use in production. Only installed needed packages. | +
Development | +pip install .[dev] |
+For use in development. Installs everything for production and extra packages for development. | +
Documentation | +pip install .[docs] |
+For use in creating documentation. Installs everything for production and extra packages for documentation. | +
All | +pip install .[all] |
+A shortcut for installing production, development and documentation dependencies. | +
Command | +Description | +
---|---|
gunicorn webqueue2api.api:app |
+This will start a local server on localhost:8000 to access the API. | +
mkdocs serve |
+This will start a local server on localhost:6060 to access the API docs. As you change API documentation files in ./docs/ you'll see your changes in the browser. |
+
mkdocs build |
+This will output a static bundle of the API documentation in ./site/ that can be put on any webserver. |
+
The webqueue2 API is publicly available at https://engineering.purdue.edu/webqueue/webqueue2/build/api but you can install it on your own machine if you'd like.
+The code is available on GitHub. Available package versions can be seen on the releases page and can be installed via pip, a requirements file, or downloaded and installed manually.
+pip available on ECN machines needs updated.
+Installation via pip is possible through pip's VCS support which was introduced in pip 19. The version of pip available on ECN supported machines is too old and needs updated. To update pip, run:
+pip install -U pop
+
Using a virtual environment is recommended for reproducibility.
+Create a virtual environment called __venv__
:
+
python3 -m venv __venv__
+
Activate the virtual environment: +
source __venv__/bin/activate
+
Update pip: +
pip install -U pip
+
To install webqueue2-api 0.9.1, you can run:
+pip install git+https://github.itap.purdue.edu/ECN/webqueue2-api@0.9.1#egg=webqueue2-api
+
To install webqueue2-api 0.9.1, place the following line your requirements file:
+echo "git+https://github.itap.purdue.edu/ECN/webqueue2-api@0.9.1#egg=webqueue2-api" >> requirements.txt
+pip install -r requirements.txt
+
If you'd like a version other than 0.9.1 simply replace the that version number with a different version listed on the releases page.
+To start the server, run the following while your virtual environment is activated: +
gunicorn webqueue2api.api:app
+
See: Material for mkdocs: Admonitions
+Note
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod +nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor +massa, nec semper lorem quam in massa.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod +nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor +massa, nec semper lorem quam in massa.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod +nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor +massa, nec semper lorem quam in massa.
+Custom Title
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod +nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor +massa, nec semper lorem quam in massa.
+See: Material for mkdocs: Code Blocks
+# This is a Python code block.
+print("Hello world!") if __name__ == "__main__"
+
1 +2 |
|
# This is a Markdown code block with line highlights and nested code block.
+ ``` js
+ ( _ => console.log("Hello world!"))();
+ ```
+
This is an inline Java highlight system.out.println("Hello world!")
See: Material for mkdocs: Content Tabs
+=== "Tab 1"
+ Hello
+=== "Tab 2"
+ World
+
Hello
+World
+!!! example
+ "Hello world" in many languages:
+ === "Python"
+ ```python
+ print("Hello world!") if __name__ == "__main__"
+ ```
+ === "JavaScript"
+ ```js
+ ( _ => console.log("Hello world!"))();
+ ```
+
Example
+"Hello world" in many languages:
+print("Hello world!") if __name__ == "__main__"
+
( _ => console.log("Hello world!"))();
+
See: Material for mkdocs: Data Tables
+| Method | Description |
+| ----------- | ------------------------------------ |
+| `GET` | :material-check: Fetch resource |
+| `PUT` | :material-check-all: Update resource |
+| `DELETE` | :material-close: Delete resource |
+
Method | +Description | +
---|---|
GET |
+Fetch resource | +
PUT |
+Update resource | +
DELETE |
+Delete resource | +
The webqueue2 API uses a two stage authentication system combining Active Directory and HTTP Token (or "bearer") authentication.
+All API calls require an access token. You can get an access token by making a POST request to the /api/login
endpoint containing the JSON encoded username and password of a valid user.
A valid user is a non-admin BoilerAD user who is in the 00000227-ECN-webqueue
group. Users cannot be added directly to this group. To be included in this group, a user must exist in one of the following groups:
00000227-ECNStaff
00000227-ECNStuds
00000227-ECN-webqueue-misc
Get an access token.
+fetch(
+ "https://engineering.purdue.edu/webqueue/webqueue2/build/api/login",
+ {
+ method: "POST",
+ headers: {'Content-Type': 'application/json'},
+ body: JSON.stringify({ "username": USERNAME, "password": PASSWORD})
+ }
+ )
+ .then( resp => resp.json() )
+ .then( data => console.log( data.access_token ))
+
// Expected Output
+"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTY1NTIyMDIsIm5iZiI6MTYxNjU1MjIwMiwianRpIjoiZDgyNGM1MWItM2JmNy00ZDUzLWE0YTgtY2VhZWQ5ZmVjNGYzIiwiZXhwIjoxNjE2NTUzMTAyLCJzdWIiOiJjYW1wYjMwMyIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsImNzcmYiOiI1Yjk5NWQ5OS05YjIzLTQyMjYtYTc0OC1lMmQ5OTA4MDkzOTQifQ.6z7EReDfhPkBkuAMHEvDuMDV4wVbqrWSjQXdRyv_5hE"
+
To interact with the API, add an Authorization
header to your request with a value of Bearer TOKEN
where TOKEN
is your access token.
Get item CE 100.
+let access_token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTY1NTIyMDIsIm5iZiI6MTYxNjU1MjIwMiwianRpIjoiZDgyNGM1MWItM2JmNy00ZDUzLWE0YTgtY2VhZWQ5ZmVjNGYzIiwiZXhwIjoxNjE2NTUzMTAyLCJzdWIiOiJjYW1wYjMwMyIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsImNzcmYiOiI1Yjk5NWQ5OS05YjIzLTQyMjYtYTc0OC1lMmQ5OTA4MDkzOTQifQ.6z7EReDfhPkBkuAMHEvDuMDV4wVbqrWSjQXdRyv_5hE";
+let queue = "ce";
+let item_number = 100;
+
+fetch(
+ `https://engineering.purdue.edu/webqueue/webqueue2/build/api/data/${queue}/${item_number}`,
+ { headers: {"Authorization":`Bearer ${access_token}` }}
+)
+.then( resp => resp.json() )
+.then( data => console.log( data ));
+
// Expected Output
+{queue: "ce", number: 100, lastUpdated: "2021-03-11T07:24:00-0500" ... }
+
When you login, you'll receive an access token that expires 15 minutes after creation as well as two cookies needed to get a new access token. Those cookies are:
+Name | +Value | +Path | +Expiration | +SameSite | +
---|---|---|---|---|
refresh_token_cookie |
+Your refresh token. | +/api/tokens/refresh |
+30 Days | +Yes | +
csrf_refresh_token |
+Additional verification data. (e.g. 7b7c1ea8-f6bb-4204-99af-cd4124a69d89 ) |
+/ |
+Session | +Yes | +
The refresh_token_cookie
is used to generate a new access token and will be sent back to the server with every request automatically. It expires 30 days after login. The csrf_refresh_token
is used to verify the refresh_token_cookie
and needs sent back as an X-CSRF-TOKEN
header.
To refresh your access token, make a POST request to the /api/tokens/refresh
endpoint with the value of the csrf_refresh_token
cookies inside a X-CSRF-TOKEN
header:
Get a new refresh token.
+// Get this value from your cookies.
+const csrf_refresh_token = "7b7c1ea8-f6bb-4204-99af-cd4124a69d89"
+
+fetch(
+ `https://engineering.purdue.edu/webqueue/webqueue2/build/api/tokens/refresh`,
+ {
+ method: "POST",
+ headers: {'X-CSRF-TOKEN': csrf_refresh_token}
+ }
+)
+.then( resp => resp.json() )
+.then( data => console.log( data.access_token ));
+
// Expected Output
+eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTY1NTIyMDIsIm5iZiI6MTYxNjU1MjIwMiwianRpIjoiZDgyNGM1MWItM2JmNy00ZDUzLWE0YTgtY2VhZWQ5ZmVjNGYzIiwiZXhwIjoxNjE2NTUzMTAyLCJzdWIiOiJjYW1wYjMwMyIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsImNzcmYiOiI1Yjk5NWQ5OS05YjIzLTQyMjYtYTc0OC1lMmQ5OTA4MDkzOTQifQ.6z7EReDfhPkBkuAMHEvDuMDV4wVbqrWSjQXdRyv_5hE
+
The webqueue2 API is organized around REST. The API has resource oriented URLs, accepts and returns JSON encoded request bodies, can be modified via the query string and uses standard HTTP response codes and verbs.
+You can use the webqueue2 API hosted at https://engineering.purdue.edu/webqueue/webqueue2/build/api or install it on your own machine.
+Get the first item in CE queue.
+let access_token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTY1NTIyMDIsIm5iZiI6MTYxNjU1MjIwMiwianRpIjoiZDgyNGM1MWItM2JmNy00ZDUzLWE0YTgtY2VhZWQ5ZmVjNGYzIiwiZXhwIjoxNjE2NTUzMTAyLCJzdWIiOiJjYW1wYjMwMyIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsImNzcmYiOiI1Yjk5NWQ5OS05YjIzLTQyMjYtYTc0OC1lMmQ5OTA4MDkzOTQifQ.6z7EReDfhPkBkuAMHEvDuMDV4wVbqrWSjQXdRyv_5hE";
+let queue = "ce";
+
+fetch(
+ `https://engineering.purdue.edu/webqueue/webqueue2/build/api/data/${queue}`,
+ { headers: {"Authorization":`Bearer ${access_token}` }}
+)
+.then( resp => resp.json() )
+.then( data => console.log( data[0].items[0] ));
+
// Expected Output
+{ queue: "ce", number: 17, lastUpdated: "2021-03-29T17:12:00-0400" ... }
+
Get the subject of an CE 1.
+let access_token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTY1NTIyMDIsIm5iZiI6MTYxNjU1MjIwMiwianRpIjoiZDgyNGM1MWItM2JmNy00ZDUzLWE0YTgtY2VhZWQ5ZmVjNGYzIiwiZXhwIjoxNjE2NTUzMTAyLCJzdWIiOiJjYW1wYjMwMyIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsImNzcmYiOiI1Yjk5NWQ5OS05YjIzLTQyMjYtYTc0OC1lMmQ5OTA4MDkzOTQifQ.6z7EReDfhPkBkuAMHEvDuMDV4wVbqrWSjQXdRyv_5hE";
+let queue = "ce";
+let item_number = 1;
+
+fetch(
+ `https://engineering.purdue.edu/webqueue/webqueue2/build/api/data/${queue}/${item_number}`,
+ { headers: {"Authorization":`Bearer ${access_token}` }}
+)
+.then( resp => resp.json() )
+.then( data => console.log( data.subject ));
+
// Expected Output
+"Linux Server Purchase"
+
An item is a chronological representation of an interaction with a user.
+GET /api/data/{queue}/{number}
+
Name | +Value | +
---|---|
queue |
+The queue of the item. | +
number |
+The number of the item. | +
Name | +Description | +Possible Values | +
---|---|---|
headers_only |
+When "True" , only meta data will be loaded. When "False" content will be parsed. (Defaults to "False" .) |
+"True" | "False" |
+
Code | +Description | +
---|---|
200 - Ok |
+On success. | +
404 - Not Found |
+When the Item does not exist. | +
500 - Internal Service Error |
+On failure. | +
Item.assigned_to
:⚓︎Type | +Description | +
---|---|
String |
+The Purdue career account alias of the person this item is assigned to. | +
Example
+console.log(Item.assigned_to)
+// Expexted Output
+"sundeep"
+
Item.building
⚓︎Type | +Description | +
---|---|
String |
+The building a particular Item is related to. | +
Example
+console.log(Item.building)
+// Expexted Output
+"ME"
+
Item.content
⚓︎Type | +Description | +
---|---|
Array<Object> |
+A chronological array of objects representing 1 of 9 possible actions taken on an item. | +
Possible Actions
+Information about the user info collected from ECNDB including but not limited to alias, phone number and office location.
+Key | +Value | +
---|---|
type |
+directory_information |
+
Name |
+The real name of the sender. | +
Login |
+The career account alias of the sender. | +
Computer |
+The computer the item is related to. Formatting may vary. | +
Location |
+Where the computer is located. | +
Email |
+The email address of the sender. | +
Phone |
+The phone number of the sender. | +
Office |
+The office location of the sender. | +
UNIX Dir |
+The home directory for the user on non-Windows systems | +
Zero Dir |
+The home directory for the user via Active Directory | +
User ECNDB |
+Link to the sender's username report in ECNDB | +
Host ECNDB |
+Link to the computer report in ECNDB | +
Subject |
+The subject of the email sent to the queue | +
{
+ "type": "directory_information",
+ "Name": "Nestor Fabian Rodriguez Buitrago",
+ "Login": "rodri563",
+ "Computer": "ce-205-38 (128.46.205.67)",
+ "Location": "HAMP G230",
+ "Email": "rodri563@purdue.edu",
+ "Phone": "7654766893",
+ "Office": "HAMP G230",
+ "UNIX Dir": "/home/bridge/b/rodri563",
+ "Zero Dir": "U=\\\\bridge.ecn.purdue.edu\\rodri563",
+ "User ECNDB": "http://eng.purdue.edu/jump/2e8399a",
+ "Host ECNDB": "http://eng.purdue.edu/jump/2e83999",
+ "Subject": "Autocad installation"
+}
+
The body of the email the item originated from.
+Key | +Value | +
---|---|
type |
+initial_message |
+
datetime |
+RFC 8061 formatted datetime string. | +
from_name |
+The sender's real name. Formatting may vary. This can be empty. | +
from_email |
+The sender's email address. | +
to |
+A list of names(s) and email(s) of people this message was sent to. | +
cc |
+A list of name(s) and email(s) of people who were CC'd. This can be empty. | +
subject |
+The subject of the initial message. | +
content |
+The content of the message as an list of strings. | +
{
+ "type": "initial_message",
+ "datetime": "2020-09-11T01:26:45+00:00",
+ "from_name": "Justin Campbell",
+ "from_email": "campb303@purdue.edu",
+ "to": [
+ { "name": "John Doe", "email": "johndoe@example.com" },
+ ],
+ "cc": [
+ { "name": "", "email": "janesmith@example.com" }
+ ],
+ "subject": Maps to item.subject,
+ "content": [
+ "I need some help with something.\n"
+ ]
+}
+
Information added by someone at ECN, usually for internal use and/or communication.
+Key | +Value | +
---|---|
type |
+edit |
+
datetime |
+RFC 8061 formatted datetime string. | +
by |
+The career account alias of the person who added the edit. | +
content |
+The content of the edit as a list of strings. | +
{
+ "type": "edit",
+ "datetime": "2020-04-22T16:39:51",
+ "by": "knewell",
+ "content": [
+ "This is related to another item. I need to do X next.\n"
+ ]
+}
+
A short message about the progress of the item.
+Key | +Value | +
---|---|
type |
+status |
+
datetime |
+RFC 8061 formatted datetime string. | +
by |
+The career account alias of the person who updated the status. | +
content |
+The content of the status as a list of strings. | +
{
+ "type": "status",
+ "datetime": "2020-04-23T10:35:47",
+ "by": "knewell",
+ "content": [
+ "Doing X thing."
+ ]
+}
+
Assigning the item to someone.
+Key | +Value | +
---|---|
type |
+assignment |
+
datetime |
+RFC 8061 formatted datetime string. | +
by |
+The career account alias of the person who changed the | +
to |
+The career account alias of the person who the item was assigned to. | +
{
+ "type": "assignment",
+ "datetime": "2020-06-23T13:27:00",
+ "by": "harley",
+ "to": "campb303",
+}
+
A message from ECN to the user and/or related parties.
+Key | +Value | +
---|---|
type |
+reply_to_user |
+
datetime |
+RFC 8061 formatted datetime string. | +
by |
+The sender's real name. Formatting may vary. This can be empty. | +
content |
+The content of the message as an list of strings | +
{
+ "type": "reply_to_user",
+ "datetime": "2020-05-08T09:21:43",
+ "by": "ewhile",
+ "content": [
+ "Sascha,\n",
+ "\n",
+ "Chicken kevin biltong, flank jowl prosciutto shoulder meatball meatloaf sirloin.\n",
+ "\n",
+ "Ethan White\n",
+ "ECN"
+ ]
+}
+
A message from ECN to the user and/or related parties.
+Key | +Value | +
---|---|
type |
+reply_to_user |
+
datetime |
+RFC 8061 formatted datetime string. | +
by |
+The sender's real name. Formatting may vary. This can be empty. | +
content |
+The content of the message as an list of strings | +
{
+ "type": "reply_to_user",
+ "datetime": "2020-05-08T09:21:43",
+ "by": "ewhile",
+ "content": [
+ "Sascha,\n",
+ "\n",
+ "Chicken kevin biltong, flank jowl prosciutto shoulder meatball meatloaf sirloin.\n",
+ "\n",
+ "Ethan White\n",
+ "ECN"
+ ]
+}
+
A message from the user and/or related parties.
+Key | +Value | +
---|---|
type |
+reply_from_user |
+
datetime |
+RFC 8061 formatted datetime string. | +
from_name |
+The sender's real name. Formatting may vary. This can be empty. | +
from_email |
+The sender's email address. | +
cc |
+A list of name(s) and email(s) of people who were CC'd. This can be empty. | +
headers |
+A dictionary of headers from the reply. | +
subject |
+The subject of the reply. | +
content |
+The content of the message as an list of strings | +
{
+ "type": "reply_from_user",
+ "datetime": "2020-05-08T13:57:18+00:00",
+ "from_name": "Reckowsky, Michael J.",
+ "from_email": "mreckowsky@purdue.edu",
+ "cc": [
+ { "name": "John Doe", "email": "johndoe@example.com" },
+ { "name": "", "email": "janesmith@example.com" }
+ ],
+ "headers" : [
+ {
+ "type": "Subject",
+ "content": "RE: New Computer Deploy"
+ },
+ {
+ "type": "From",
+ "content": "\"Reckowsky, Michael J.\" <mreckowsky@purdue.edu>"
+ },
+ {
+ "type": "Date",
+ "content": "Fri, 8 May 2020 13:57:17 +0000"
+ },
+ ],
+ "subject": "RE: New Computer Deploy",
+ "content": [
+ "Ethan,\n",
+ "\n",
+ "Biltong beef ribs doner chuck, pork chop jowl salami cow filet mignon pork.\n",
+ "\n",
+ "Mike\n",
+ ]
+}
+
An error caused by a malformed delimiter or nested delimiters.
+Key | +Value | +
---|---|
type |
+parse_error |
+
datetime |
+RFC 8061 formatted datetime string. | +
file_path |
+Full path of the item with the error. | +
expected |
+Description of what the parser was expecting. | +
got |
+Line that cause the parse error. | +
line_num |
+The line number in the item that caused the parse error. | +
{
+ 'type': 'parse_error',
+ 'datetime': '2020-10-16T10:44:45',
+ 'file_path': '/home/pier/e/benne238/webqueue2/q-snapshot/aae/2',
+ 'expected': 'Did not encounter a reply-from-user ending delimiter',
+ 'got': 'Kris',
+ 'line_num': 468
+}
+
Item.date_received
⚓︎Type | +Description | +
---|---|
String |
+An ISO 8601 formatted time string showing the date this item was created. | +
Example
+console.log(Item.date_received)
+// Expexted Output
+"2021-04-03T00:48:38+00:00"
+
Item.department
⚓︎Type | +Description | +
---|---|
String |
+The most recent department for this item. | +
Example
+console.log(Item.department)
+// Expexted Output
+"Bussiness Office"
+
Item.headers
⚓︎Type | +Description | +
---|---|
Array<Object> |
+An array of objects containing parsed item headers in type /value pairs. |
+
Example
+console.log(Item.headers[0])
+// Expexted Output
+{ type: "From", content: "\"Campbell, Justin Tyler\" <campb303@purdue.edu>\n"}
+
Item.is_locked
⚓︎Type | +Description | +
---|---|
Boolean |
+A boolean showing whether or not a lockfile for the item is present. | +
Example
+console.log(Item.is_locked)
+// Expexted Output
+true
+
Item.last_updated
⚓︎Type | +Description | +
---|---|
String |
+An ISO 8601 formatted time string showing the last time the file was updated according to the filesystem. | +
Example
+console.log(Item.last_updated)
+// Expected Output
+"2021-04-03T00:48:38+00:00"
+
Item.number
⚓︎Type | +Description | +
---|---|
Number |
+The indentifying number of the queue item. | +
Example
+console.log(Item.number)
+// Expected Output
+4
+
Item.path
⚓︎Type | +Description | +
---|---|
String |
+The absolute file path to the Item. | +
Example
+console.log(Item.path)
+// Expected Output
+"/home/pier/e/queue/Mail/ce/1"
+
Item.priority:
⚓︎Type | +Description | +
---|---|
String |
+The most recent priority for this item. | +
Example
+console.log(Item.priority)
+// Expexted Output
+"COVID"
+
Item.queue:
⚓︎Type | +Description | +
---|---|
String |
+The queue the Item is in. | +
Example
+console.log(Item.queue)
+// Expexted Output
+"ce"
+
Item.status
⚓︎Type | +Description | +
---|---|
String |
+The most recent status update for the item. | +
Example
+console.log(Item.status)
+// Expexted Output
+"Waiting for Reply"
+
Item.subject:
⚓︎Type | +Description | +
---|---|
String |
+The subject of the original message for this item. | +
Example
+console.log(Item.subject)
+// Expexted Output
+"Can't Access Outlook"
+
Item.user_alias
:⚓︎Type | +Description | +
---|---|
String |
+The Purdue career account alias of the person this item is from. | +
Example
+console.log(Item.user_alias)
+// Expexted Output
+"campb303"
+
Item.user_email
⚓︎Type | +Description | +
---|---|
String |
+The email address of the person who this item is from. | +
Example
+console.log(Item.user_email)
+// Expexted Output
+"campb303@purdue.edu"
+
Item.user_name
⚓︎Type | +Description | +
---|---|
String |
+The real name of the person who this item is from. | +
Example
+console.log(Item.user_name)
+// Expexted Output
+"Justin Campbell"
+
A collection of Items.
+GET /api/data/{queue}
+
Name | +Value | +
---|---|
queue |
+The name of the queue. | +
Name | +Description | +Possible Values | +
---|---|---|
headers_only |
+When "True" , only meta data will be loaded. When "False" content will be parsed. (Defaults to "True" .) |
+"True" | "True" |
+
Code | +Description | +
---|---|
200 - Ok |
+On success. | +
404 - Not Found |
+When the Queue does not exist. | +
500 - Internal Service Error |
+On failure. | +
Queue.name
⚓︎Type | +Description | +
---|---|
String |
+The name of the queue. | +
Example
+console.log(Queue.name)
+// Expected Output
+"ce"
+
Queue.path
⚓︎Type | +Description | +
---|---|
String |
+The absolute file path to the Queue. | +
Example
+console.log(Queue.path)
+// Expected Output
+"/home/pier/e/queue/Mail/ce"
+
Queue.items
⚓︎Type | +Description | +
---|---|
Array<Object> |
+The Items in the queue. | +
Example
+console.log(Queue.items)
+// Expected Output
+[
+ { queue: "ce", number: 01, lastUpdated: "2021-03-26T17:12:00-0400" ... }
+ { queue: "ce", number: 02, lastUpdated: "2021-05-29T17:12:00-0400" ... }
+ { queue: "ce", number: 03, lastUpdated: "2020-12-29T17:12:00-0400" ... }
+]
+
\n {translation(\"search.result.term.missing\")}: {...missing}\n
\n }\n