# Buildium::WorkOrdersApi All URIs are relative to *https://api.buildium.com* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**create_work_order**](WorkOrdersApi.md#create_work_order) | **POST** /v1/workorders | Create a work order | | [**get_all_work_orders**](WorkOrdersApi.md#get_all_work_orders) | **GET** /v1/workorders | Retrieve all work orders | | [**get_work_order_by_id**](WorkOrdersApi.md#get_work_order_by_id) | **GET** /v1/workorders/{workOrderId} | Retrieve a work order | | [**update_work_order**](WorkOrdersApi.md#update_work_order) | **PUT** /v1/workorders/{workOrderId} | Update a work order | ## create_work_order > create_work_order(create_work_order_request) Create a work order Creates a work order.

Required permission(s):

Maintenance > Work Orders - `View` `Edit` ### Examples ```ruby require 'time' require 'buildium-ruby' # setup authorization Buildium.configure do |config| # Configure API key authorization: clientId config.api_key['clientId'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientId'] = 'Bearer' # Configure API key authorization: clientSecret config.api_key['clientSecret'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientSecret'] = 'Bearer' end api_instance = Buildium::WorkOrdersApi.new create_work_order_request = Buildium::CreateWorkOrderRequest.new({entry_allowed: 'Unknown', vendor_id: 37}) # CreateWorkOrderRequest | begin # Create a work order result = api_instance.create_work_order(create_work_order_request) p result rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->create_work_order: #{e}" end ``` #### Using the create_work_order_with_http_info variant This returns an Array which contains the response data, status code and headers. > , Integer, Hash)> create_work_order_with_http_info(create_work_order_request) ```ruby begin # Create a work order data, status_code, headers = api_instance.create_work_order_with_http_info(create_work_order_request) p status_code # => 2xx p headers # => { ... } p data # => rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->create_work_order_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **create_work_order_request** | [**CreateWorkOrderRequest**](CreateWorkOrderRequest.md) | | | ### Return type [**WorkOrderMessage**](WorkOrderMessage.md) ### Authorization [clientId](../README.md#clientId), [clientSecret](../README.md#clientSecret) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ## get_all_work_orders > > get_all_work_orders(opts) Retrieve all work orders Retrieves a list of work orders.

Required permission(s):

Maintenance > Work Orders - `View` ### Examples ```ruby require 'time' require 'buildium-ruby' # setup authorization Buildium.configure do |config| # Configure API key authorization: clientId config.api_key['clientId'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientId'] = 'Bearer' # Configure API key authorization: clientSecret config.api_key['clientSecret'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientSecret'] = 'Bearer' end api_instance = Buildium::WorkOrdersApi.new opts = { entitytype: 'Rental', # String | Specifies the type of entity that the `EntityId` field refers to. This field is required if the `EntityId` field is populated. entityid: 56, # Integer | Filters results to any work order associated with the specified entity id value. The value must be of the type specified in the `EntityType` field. statuses: ['New'], # Array | Filters results by the status of the task associated with the work order. If no status is specified, work orders with any status will be returned. type: 'ContactRequest', # String | Filters results to any work order with an associated task with the task type specified. unitid: 56, # Integer | Filters results to any work order associated with the unit identifier. unitagreementid: 56, # Integer | Filters results to any work order associated with the unit agreement identifier specified. lastupdatedfrom: Date.parse('2013-10-20'), # Date | Filters results to any work orders were updated on or after the specified date. The value must be formatted as YYYY-MM-DD. lastupdatedto: Date.parse('2013-10-20'), # Date | Filters results to any work orders were updated on or before the specified date. The value must be formatted as YYYY-MM-DD. duedatefrom: Date.parse('2013-10-20'), # Date | Filters results to any work orders with a due date on or after the specified date. The value must be formatted as YYYY-MM-DD. duedateto: Date.parse('2013-10-20'), # Date | Filters results to any work orders with a due date on or before the specified date. The value must be formatted as YYYY-MM-DD. taskcategoryid: 56, # Integer | Filters results to any work orders whose priority matches the specified values. If no priority is specified, tasks with any priority will be returned. priorities: ['Low'], # Array | Filters results to any work orders that have been assigned to the specified staff user identifier. assignedtoid: 56, # Integer | Filters results to any work orders that have been assigned to the specified staff user identifier. vendorids: [37], # Array | Filters results to any work orders that have been assigned to the specified vendor identifier. amountfrom: 1.2, # Float | Filters results to any work orders whose total amounts are equal or greater than the specified amount. amountto: 1.2, # Float | Filters results to any work orders whose total amounts are equal or less than the specified amount. isbilled: true, # Boolean | Filters results to work orders that have an associated bill. title: 'title_example', # String | Filters results to any work orders whose title *contains* the specified value. taskids: [37], # Array | Filters results to work orders that have an associated to a task in the specified list. orderby: 'orderby_example', # String | `orderby` indicates the field(s) and direction to sort the results in the response. See Bulk Request Options for more information. offset: 56, # Integer | `offset` indicates the position of the first record to return. The `offset` is zero-based and the default is 0. limit: 56 # Integer | `limit` indicates the maximum number of results to be returned in the response. `limit` can range between 1 and 1000 and the default is 50. } begin # Retrieve all work orders result = api_instance.get_all_work_orders(opts) p result rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->get_all_work_orders: #{e}" end ``` #### Using the get_all_work_orders_with_http_info variant This returns an Array which contains the response data, status code and headers. > >, Integer, Hash)> get_all_work_orders_with_http_info(opts) ```ruby begin # Retrieve all work orders data, status_code, headers = api_instance.get_all_work_orders_with_http_info(opts) p status_code # => 2xx p headers # => { ... } p data # => > rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->get_all_work_orders_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **entitytype** | **String** | Specifies the type of entity that the `EntityId` field refers to. This field is required if the `EntityId` field is populated. | [optional] | | **entityid** | **Integer** | Filters results to any work order associated with the specified entity id value. The value must be of the type specified in the `EntityType` field. | [optional] | | **statuses** | [**Array<String>**](String.md) | Filters results by the status of the task associated with the work order. If no status is specified, work orders with any status will be returned. | [optional] | | **type** | **String** | Filters results to any work order with an associated task with the task type specified. | [optional] | | **unitid** | **Integer** | Filters results to any work order associated with the unit identifier. | [optional] | | **unitagreementid** | **Integer** | Filters results to any work order associated with the unit agreement identifier specified. | [optional] | | **lastupdatedfrom** | **Date** | Filters results to any work orders were updated on or after the specified date. The value must be formatted as YYYY-MM-DD. | [optional] | | **lastupdatedto** | **Date** | Filters results to any work orders were updated on or before the specified date. The value must be formatted as YYYY-MM-DD. | [optional] | | **duedatefrom** | **Date** | Filters results to any work orders with a due date on or after the specified date. The value must be formatted as YYYY-MM-DD. | [optional] | | **duedateto** | **Date** | Filters results to any work orders with a due date on or before the specified date. The value must be formatted as YYYY-MM-DD. | [optional] | | **taskcategoryid** | **Integer** | Filters results to any work orders whose priority matches the specified values. If no priority is specified, tasks with any priority will be returned. | [optional] | | **priorities** | [**Array<String>**](String.md) | Filters results to any work orders that have been assigned to the specified staff user identifier. | [optional] | | **assignedtoid** | **Integer** | Filters results to any work orders that have been assigned to the specified staff user identifier. | [optional] | | **vendorids** | [**Array<Integer>**](Integer.md) | Filters results to any work orders that have been assigned to the specified vendor identifier. | [optional] | | **amountfrom** | **Float** | Filters results to any work orders whose total amounts are equal or greater than the specified amount. | [optional] | | **amountto** | **Float** | Filters results to any work orders whose total amounts are equal or less than the specified amount. | [optional] | | **isbilled** | **Boolean** | Filters results to work orders that have an associated bill. | [optional] | | **title** | **String** | Filters results to any work orders whose title *contains* the specified value. | [optional] | | **taskids** | [**Array<Integer>**](Integer.md) | Filters results to work orders that have an associated to a task in the specified list. | [optional] | | **orderby** | **String** | `orderby` indicates the field(s) and direction to sort the results in the response. See <a href=\"#section/API-Overview/Bulk-Request-Options\">Bulk Request Options</a> for more information. | [optional] | | **offset** | **Integer** | `offset` indicates the position of the first record to return. The `offset` is zero-based and the default is 0. | [optional] | | **limit** | **Integer** | `limit` indicates the maximum number of results to be returned in the response. `limit` can range between 1 and 1000 and the default is 50. | [optional] | ### Return type [**Array<WorkOrderMessage>**](WorkOrderMessage.md) ### Authorization [clientId](../README.md#clientId), [clientSecret](../README.md#clientSecret) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ## get_work_order_by_id > get_work_order_by_id(work_order_id) Retrieve a work order Retrieves a specific work order.

Required permission(s):

Maintenance > Work Orders - `View` ### Examples ```ruby require 'time' require 'buildium-ruby' # setup authorization Buildium.configure do |config| # Configure API key authorization: clientId config.api_key['clientId'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientId'] = 'Bearer' # Configure API key authorization: clientSecret config.api_key['clientSecret'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientSecret'] = 'Bearer' end api_instance = Buildium::WorkOrdersApi.new work_order_id = 56 # Integer | begin # Retrieve a work order result = api_instance.get_work_order_by_id(work_order_id) p result rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->get_work_order_by_id: #{e}" end ``` #### Using the get_work_order_by_id_with_http_info variant This returns an Array which contains the response data, status code and headers. > , Integer, Hash)> get_work_order_by_id_with_http_info(work_order_id) ```ruby begin # Retrieve a work order data, status_code, headers = api_instance.get_work_order_by_id_with_http_info(work_order_id) p status_code # => 2xx p headers # => { ... } p data # => rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->get_work_order_by_id_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **work_order_id** | **Integer** | | | ### Return type [**WorkOrderMessage**](WorkOrderMessage.md) ### Authorization [clientId](../README.md#clientId), [clientSecret](../README.md#clientSecret) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ## update_work_order > update_work_order(work_order_id, update_work_order_request) Update a work order Updates a work order.

NOTE: Any field not included in the update request will be set to either an empty string or `null` in the database depending on the field definition.
The recommended workflow to ensure no data is inadvertently overwritten is to execute a `GET` request for the resource you're about to update and then use this response to fill any of the fields that are not being updated.

Required permission(s):

Maintenance > Work Orders - `View` `Edit` ### Examples ```ruby require 'time' require 'buildium-ruby' # setup authorization Buildium.configure do |config| # Configure API key authorization: clientId config.api_key['clientId'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientId'] = 'Bearer' # Configure API key authorization: clientSecret config.api_key['clientSecret'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['clientSecret'] = 'Bearer' end api_instance = Buildium::WorkOrdersApi.new work_order_id = 56 # Integer | update_work_order_request = Buildium::UpdateWorkOrderRequest.new({entry_allowed: 'Unknown', vendor_id: 37}) # UpdateWorkOrderRequest | begin # Update a work order result = api_instance.update_work_order(work_order_id, update_work_order_request) p result rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->update_work_order: #{e}" end ``` #### Using the update_work_order_with_http_info variant This returns an Array which contains the response data, status code and headers. > , Integer, Hash)> update_work_order_with_http_info(work_order_id, update_work_order_request) ```ruby begin # Update a work order data, status_code, headers = api_instance.update_work_order_with_http_info(work_order_id, update_work_order_request) p status_code # => 2xx p headers # => { ... } p data # => rescue Buildium::ApiError => e puts "Error when calling WorkOrdersApi->update_work_order_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **work_order_id** | **Integer** | | | | **update_work_order_request** | [**UpdateWorkOrderRequest**](UpdateWorkOrderRequest.md) | | | ### Return type [**WorkOrderMessage**](WorkOrderMessage.md) ### Authorization [clientId](../README.md#clientId), [clientSecret](../README.md#clientSecret) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json