Skip to content
John Sullivan edited this page Jul 4, 2013 · 4 revisions

The API Client is a command line client, which means that often you can get things done much faster than with a GUI, but it also means that sometimes you've got to do a lot of typing.

In order to reduce the amount of typing and frustration that might develop from using the API Client, there are a number of very useful features the client supports to make your life easier. Take a glance through this page to learn about them.

Named Arguments

Some of the API commands have a lot of parameters and specifying each one on the command line can be a real pain. That is why the API client has support for named arguments. To specify the value for an argument by name, use the notation argument_name=value.

For example, the modify_assignment command has a lot of parameters, but it is likely that you will only want to specify a value for one or two of them.

>  modify_assignment mine/domination due="10/20/2012 10:09:00"
Success! The following changes were applied to Assignment [id = 50907db055c4481a5027103d, name = World Domination].
    Due date changed from '11/01/2012 00:00:00' to '10/20/2012 10:09:00'.

Note that I used the shorthand notation for referencing assignments which is introduced below.

Referencing Objects

A number of the API commands will ask for an assignment, a class, or a user (for example, class_info wants a class as the first argument).

You can always reference an object by its unique ID, however, these can be long and annoying to even copy and paste around, so there are a some handy short-hand ways to reference each class of objects that you can use instead.

Users

Users must be specified by their full emails, there's no shortcut for users unfortunately. However, if you want to reference you (the current user), you can enter in me wherever a user is expected.

> user_info me
User [email = jsull003@school.edu, account_type = admin] is enrolled in:
    Class [id = 5090634855c448134f67b3e3, name = CS 9001]

Classes

When specifying a class, you may provide a string and Galah will look for classes with that string in its name (the search is case insensitive). If multiple classes match, an error will be displayed.

> class_info woodshop
Class [id = 5090671655c448134f67b3e5, name = Woodshop 101] has assignments:
    (No assignments)
> class_info 10
Your command cannot be completed as entered: 2 classes match your query of '10', however, this API expects 1 class. Refine your query and try again.
    Class [id = 509066e855c448134f67b3e4, name = CS 10]
    Class [id = 5090671655c448134f67b3e5, name = Woodshop 101]

Assignments

When specifying an assignment, you can use the format class/assignment where class is a class specified just like how you'd normally specify a class (you can give an ID or a string as described above) and assignment is a partial string of the assignment's name that you want to reference, similar to how you specify classes.

> assignment_info 9001/domination
Properties of Assignment [id = 50907db055c4481a5027103d, name = World Domination]:
    for_class = 5090634855c448134f67b3e3
    due_cutoff = 11/01/2012 00:00:00
    name = World Domination
    hide_until = 11/08/2012 18:00:00
    due = 11/01/2012 00:00:00
> assignment_info 9001/part
Your command cannot be completed as entered: 5 assignments in Class [id = 5090634855c448134f67b3e3, name = CS 9001] matched your query of {name contains 'part'}, however this API expects 1 assignment. Refine your query and try again.
    Assignment [id = 509c573255c448108291c206, name = Lots of Assignments - Part 1]
    Assignment [id = 509c594f55c44810f90ec14d, name = Lots of Assignments - Part 2]
    Assignment [id = 509c595655c44810f90ec14e, name = Lots of Assignments - Part 3]
    Assignment [id = 509c595a55c44810f90ec14f, name = Lots of Assignments - Part 4]
    Assignment [id = 509c595e55c44810f90ec150, name = Lots of Assignments - Part 5]
> assignment_info "9001/part 2"
Properties of Assignment [id = 509c594f55c44810f90ec14d, name = Lots of Assignments - Part 2]:
    for_class = 5090634855c448134f67b3e3
    name = Lots of Assignments - Part 2
    hide_until = 01/01/1970 00:00:00
    due = 11/01/2012 00:00:00

mine may be specified for class if you want to search within all of the classes your are enrolled in or assigned to.

> assignment_info mine/domination
Properties of Assignment [id = 50907db055c4481a5027103d, name = World Domination]:
    for_class = 5090634855c448134f67b3e3
    due_cutoff = 11/01/2012 00:00:00
    name = World Domination
    hide_until = 11/08/2012 18:00:00
    due = 11/01/2012 00:00:00
> assignment_info mine/part
Your command cannot be completed as entered: 5 assignments in classes you are enrolled in or assigned to matched your query of {name contains 'part'}, however this API expects 1 assignment. Refine your query and try again.
    Assignment [id = 509c573255c448108291c206, name = Lots of Assignments - Part 1]
    Assignment [id = 509c594f55c44810f90ec14d, name = Lots of Assignments - Part 2]
    Assignment [id = 509c595655c44810f90ec14e, name = Lots of Assignments - Part 3]
    Assignment [id = 509c595a55c44810f90ec14f, name = Lots of Assignments - Part 4]
    Assignment [id = 509c595e55c44810f90ec150, name = Lots of Assignments - Part 5]