How to obtain a list of departments from the FWS API

Departments can be retrieved by using the following URL and specifying a starting record number and ending record number.  If left blank, this will default to the first 50 records.  Departments are returned in order of name, or closest matched search if a full text search is performed.

 

 Method URL
 GET  https://api.fairwarningsoftware.com/v1.1.1/departments/[start]/[limit]

 

 Status Response
 200  {"departments":[
    {
        "department_id": <department_id>,
        "company_id": <company_id>,
        "department_active": <department_active>,
        "department_name": <department_name>,
        "department_contact_name": <department_contact_name>,
        "department_contact_email": <department_contact_email>,
        "department_image": <department_image>,
        "department_copy": <department_copy>,
        "department_image": {
                "base" : [url-base],
                "parts" : {
                    "large" : [url-addition],
                    "medium" : [url-addition],
                    "small" : [url-addition]
                }
            }
    },
    "record_count" : <record_count>
]}
401  {"error":"The API keys provided are invalid."}
403  {"error":"API keys are missing."}
500  {"error": <custom error>}

 

 Field  Type Description
department_id int The unique identifier for the department
company_id int The ID for your company
department_active bool Whether the auction is active or not
department_name string The name of the department
department_contact_name string The name of the contact person for the department
department_contact_email string The email of the contact person for the department
department_copy string The copy for the department
department_image object An object containing the base and paths to the different image sizes of the primary image
    base string The base will contain the first part of the URL needed to retrieve the specified image.
    parts object This will contain an array of URL parts for the different sizes of images.
        large string The end of the URL to retrieve a large-sized image.
        medium string The end of the URL to retrieve a medium-sized image.
        small string The end of the URL to retrieve a small-sized image.
record_count int The total number of records matching the search results

 

You may also choose to search the department in order to retrieve more specific results.  For instance, if you are only looking for departments with the words "consignment" and "photography", you could pass query parameters to specify the full text search you want the department results to contain.

{ "department_copy": { "operator" : "full_search", "value": "consignment photography" } }

By passing this data string as raw post data, you will limit your results to only departments that contain the text search for.

Below is a list of search fields that you can perform a full text search on:

  • department_name
  • department_copy

 

To retrieve a short list (up to 4) of past auctions related to a department, you may pass a flag "get_past_auctions" in your post data.

{"get_past_auctions":1}

This will return an additional element within the department list called `auctions` containing a list of auctions.