### Get All Change Orders - Node.js Request Example Source: https://developers.fieldwire.com/reference/change-orders Example Node.js code using the 'axios' library to fetch change orders. It demonstrates setting up the request URL and headers, including authentication (placeholder) and API version. ```javascript const axios = require('axios'); const projectId = 'your_project_id'; const region = 'us'; // e.g., 'us', 'eu' const apiUrl = `https://client-api.${region}.fieldwire.com/api/v3/projects/${projectId}/change_orders`; const headers = { 'accept': 'application/json', 'Fieldwire-Version': 'YYYY-MM-DD', // Replace with the current date or desired API version 'Authorization': 'Bearer YOUR_API_TOKEN' // Replace with your actual API token }; axios.get(apiUrl, { headers: headers }) .then(response => { console.log('Change Orders:', response.data); }) .catch(error => { console.error('Error fetching change orders:', error); }); ``` -------------------------------- ### Get Project Templates (Ruby) Source: https://developers.fieldwire.com/reference/project-templates Ruby code example using the 'net/http' library to perform a GET request for project templates. It demonstrates setting the request URI and headers. ```ruby require 'net/http' require 'uri' uri = URI.parse("https://client-api.us.fieldwire.com/api/v3/account/project_templates") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) request['accept'] = 'application/json' response = http.request(request) puts response.body ``` -------------------------------- ### Get All Change Orders - Python Request Example Source: https://developers.fieldwire.com/reference/change-orders Example Python code using the 'requests' library to retrieve change orders. It shows how to construct the URL and pass necessary headers for the API request. ```python import requests project_id = 'your_project_id' region = 'us' # e.g., 'us', 'eu' api_url = f"https://client-api.{region}.fieldwire.com/api/v3/projects/{project_id}/change_orders" headers = { 'accept': 'application/json', 'Fieldwire-Version': 'YYYY-MM-DD', # Replace with the current date or desired API version 'Authorization': 'Bearer YOUR_API_TOKEN' # Replace with your actual API token } try: response = requests.get(api_url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes change_orders = response.json() print("Change Orders:", change_orders) except requests.exceptions.RequestException as e: print(f"Error fetching change orders: {e}") ``` -------------------------------- ### Get All Actual Costs for a Project (Python) Source: https://developers.fieldwire.com/reference/actual-costs Example using Python to fetch actual costs. This snippet uses the `requests` library to make the GET request to the Fieldwire API. ```python import requests project_id = 'your_project_id' region = 'your_region' # e.g., 'us', 'eu' api_version = 'YYYY-MM-DD' # Replace with actual date url = f"https://client-api.{region}.fieldwire.com/api/v3/projects/{project_id}/budget_actual_costs" headers = { 'Fieldwire-Version': api_version, 'accept': 'application/json' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) actual_costs = response.json() print(actual_costs) except requests.exceptions.RequestException as e: print(f"Error fetching actual costs: {e}") ``` -------------------------------- ### Get Account Data Type Values (Node.js) Source: https://developers.fieldwire.com/reference/account-data-type-values Provides a Node.js example for making a GET request to retrieve account data type values. This snippet utilizes the 'axios' library for HTTP requests and assumes proper authentication setup. ```javascript const axios = require('axios'); const getAccountDataTypeValues = async (region, options = {}) => { try { const response = await axios.get( `https://client-api.${region}.fieldwire.com/api/v3/account/account_data_type_values`, { headers: { 'accept': 'application/json', // Add other required headers like 'Fieldwire-Version', 'Authorization', etc. ...options.headers }, params: options.params // e.g., { last_synced_at: '2023-01-01T10:00:00Z' } } ); return response.data; } catch (error) { console.error('Error fetching account data type values:', error.response ? error.response.data : error.message); throw error; } }; // Example Usage: // getAccountDataTypeValues('us', { headers: { 'Fieldwire-Version': '3.1' } }) // .then(data => console.log(data)) // .catch(err => console.error(err)); ``` -------------------------------- ### Get Project Template Checklists (Ruby) Source: https://developers.fieldwire.com/reference/template-checklists Provides a Ruby example for making the API request, likely using the 'net/http' library or a gem. It illustrates constructing the request and processing the response. ```ruby # Ruby example would go here, using Net::HTTP or an HTTP client gem # require 'net/http' # require 'uri' # # uri = URI.parse("https://client-api.us.fieldwire.com/api/v3/projects/project_id/template_checklists") # http = Net::HTTP.new(uri.host, uri.port) # http.use_ssl = true # # request = Net::HTTP::Get.new(uri.request_uri) # request['accept'] = 'application/json' # request['Fieldwire-Version'] = 'YYYY-MM-DD' # Replace with actual date # # response = http.request(request) # puts response.body ``` -------------------------------- ### POST /websites/developers_fieldwire_reference/projects Source: https://developers.fieldwire.com/reference/add_projects Creates a new project with specified configurations. Supports cloning from existing projects or templates, and copying associated data. ```APIDOC ## POST /projects ### Description Creates a new project with specified configurations. Supports cloning from existing projects or templates, and copying associated data. ### Method POST ### Endpoint /projects ### Parameters #### Query Parameters - **name** (string) - Required - The name of the new project. - **timezone** (string) - Optional - The timezone for the project. Accepts a valid IANA timezone string. - **measurement_units** (string) - Optional - The unit system for measurements. Enum: ['imperial', 'metric']. - **box_token_user_id** (integer) - Optional - User ID with an active Box token for the new project. - **dropbox_token_user_id** (integer) - Optional - User ID with an active Dropbox token for the new project. #### Request Body - **source** (object) - Optional - Defines the source for the new project. - **id** (string, uuid) - Optional - ID of the project to clone from. - **project_template_id** (string, uuid) - Optional - ID of the project template to generate from. - **copy_users** (boolean) - Optional - True to copy users. - **copy_teams** (boolean) - Optional - True to copy teams. - **copy_template_checklists** (boolean) - Optional - True to copy template checklists. - **copy_report_templates** (boolean) - Optional - True to copy report templates. - **copy_locations** (boolean) - Optional - True to copy locations. - **copy_form_templates** (boolean) - Optional - True to copy form templates. - **copy_folders** (boolean) - Optional - True to copy folders. - **copy_settings** (boolean) - Optional - True to copy settings. - **copy_statuses** (boolean) - Optional - True to copy statuses. ### Request Example ```json { "name": "New Project Name", "timezone": "Australia/Brisbane", "measurement_units": "metric", "source": { "project_template_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "copy_users": true, "copy_folders": true } } ``` ### Response #### Success Response (200) - **id** (string, uuid) - The unique identifier for the newly created project. - **name** (string) - The name of the project. - **timezone** (string) - The configured timezone of the project. - **measurement_units** (string) - The configured measurement units for the project. #### Response Example ```json { "id": "f0e9d8c7-b6a5-4321-0987-fedcba012345", "name": "New Project Name", "timezone": "Australia/Brisbane", "measurement_units": "metric" } ``` ``` -------------------------------- ### Get Account Data Type Values (PHP) Source: https://developers.fieldwire.com/reference/account-data-type-values Demonstrates fetching account data type values using PHP with cURL. This example outlines the request setup, including URL and headers. ```php = 200 && $httpCode < 300) { return json_decode($response, true); } else { error_log("Error fetching account data type values: HTTP Code {$httpCode}, Response: " . $response); return null; } } // Example Usage: // $apiRegion = 'us'; // $queryParams = ['last_synced_at' => '2023-01-01T10:00:00Z']; // $customHeaders = ['Authorization: Bearer YOUR_API_TOKEN']; // $data = getAccountDataTypeValues($apiRegion, ['params' => $queryParams, 'headers' => $customHeaders]); // if ($data !== null) { // print_r($data); // } else { // echo "Failed to retrieve data."; // } ?> ``` -------------------------------- ### Get All Change Orders - PHP Request Example Source: https://developers.fieldwire.com/reference/change-orders Example PHP code using cURL to make a GET request for change orders. It demonstrates setting the URL, headers, and handling the JSON response. ```php ``` -------------------------------- ### Get Attachment by ID - Ruby Example Source: https://developers.fieldwire.com/reference/attachments Ruby code example utilizing the 'httparty' gem to fetch attachment details. The code constructs the API URL and sets the 'accept' header for the GET request. ```ruby require 'httparty' project_id = 'your_project_id' attachment_id = 'your_attachment_id' region = 'us' # or your specific region url = "https://client-api.#{region}.fieldwire.com/api/v3/projects/#{project_id}/attachments/#{attachment_id}" begin response = HTTParty.get(url, headers: { 'accept' => 'application/json' }) if response.success? puts response.parsed_response else puts "Error fetching attachment: #{response.code} - #{response.message}" end rescue StandardError => e puts "An error occurred: #{e.message}" end ``` -------------------------------- ### POST /websites/developers_fieldwire_reference/projects Source: https://developers.fieldwire.com/reference/add_projects Creates a new project with specified details. Optionally copies statuses and tags from a source project. ```APIDOC ## POST /websites/developers_fieldwire_reference/projects ### Description Creates a new project. This endpoint allows for the creation of a new project with various configuration options. It also supports copying statuses and tags from an existing project if specified. ### Method POST ### Endpoint `/websites/developers_fieldwire_reference/projects` ### Parameters #### Request Body - **name** (string) - Required - The name of the new project. - **copy_statuses** (boolean) - Optional - If true, statuses will be copied to the new project. - **copy_tags** (boolean) - Optional - If true, tags will be copied to the new project. ### Request Example ```json { "name": "New Project Name", "copy_statuses": true, "copy_tags": false } ``` ### Response #### Success Response (201 Created) - **id** (string) - The unique identifier for the newly created project. - **name** (string) - The name of the created project. - **created_at** (string) - The timestamp when the project was created. #### Response Example ```json { "id": "proj_12345abcde", "name": "New Project Name", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Get Attachment by ID - Node.js Example Source: https://developers.fieldwire.com/reference/attachments Example of fetching attachment details using Node.js with the 'axios' library. It constructs the URL with project and attachment IDs and sends a GET request with an 'accept' header. ```javascript const axios = require('axios'); const projectId = 'your_project_id'; const attachmentId = 'your_attachment_id'; const region = 'us'; // or your specific region axios.get(`https://client-api.${region}.fieldwire.com/api/v3/projects/${projectId}/attachments/${attachmentId}`, { headers: { 'accept': 'application/json' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching attachment:', error); }); ``` -------------------------------- ### Get account_form_templates with cURL Source: https://developers.fieldwire.com/reference/account-form-templates This cURL example demonstrates how to retrieve account form templates from the Fieldwire API. It includes the GET request method, the API endpoint URL, and the necessary header for accepting JSON responses. The example is a basic request and does not include authentication. ```cURL curl --request GET \ --url https://client-api.us.fieldwire.com/api/v3/account/account_form_templates \ --header 'accept: application/json' ``` -------------------------------- ### POST /websites/developers_fieldwire_reference/project_templates Source: https://developers.fieldwire.com/reference/create_project_template_in_account Creates a new project template with the specified configuration. ```APIDOC ## POST /websites/developers_fieldwire_reference/project_templates ### Description Creates a new project template with the specified configuration. ### Method POST ### Endpoint /websites/developers_fieldwire_reference/project_templates #### Request Body - **project_template** (object) - Required - The configuration for the new project template. - **creator_user_id** (integer) - Required - ID of the user who created this entity - **last_editor_user_id** (integer) - Required - ID of the user who most recently edited this entity - **name** (string) - Required - Name of the template - **id** (string) - Optional - ID of the entity - **account_id** (integer) - Optional - ID of the account this entity belongs to - **created_at** (string) - Optional - Time when the server created the entity - **deleted_at** (string) - Optional - Time when the server deleted the entity - **is_email_notifications_enabled** (boolean) - Optional - Whether email notifications are enabled for this project - **is_plan_email_notifications_enabled** (boolean) - Optional - Whether notifications should be sent out on processing plans - **is_rfis_enabled** (boolean) - Optional - If this is a rfis enabled project template - **is_submittals_enabled** (boolean) - Optional - If submittals are enabled for the project template - **is_change_orders_enabled** (boolean) - Optional - If change orders are enabled on the project template - **is_budget_enabled** (boolean) - Optional - If budget are enabled on the project template - **prompt_effort_on_complete** (boolean) - Optional - Whether prompt to input effort should be shown on marking tasks as completed - **is_mobile_location_creation_enabled** (boolean) - Optional - If location creation on mobile is enabled for this project template - **min_verified_at_days** (integer) - Optional - Count of days after which verified tasks are archived - **sheets_limit** (integer) - Optional - Count of the latest sheet versions that should be cached on the mobile apps ### Request Example ```json { "project_template": { "creator_user_id": 123, "last_editor_user_id": 123, "name": "My Project Template", "is_rfis_enabled": true } } ``` ### Response #### Success Response (200) - **project_template** (object) - The created project template details. - **id** (string) - ID of the entity - **creator_user_id** (integer) - ID of the user who created this entity - **last_editor_user_id** (integer) - ID of the user who most recently edited this entity - **account_id** (integer) - ID of the account this entity belongs to - **name** (string) - Name of the template - **created_at** (string) - Time when the server created the entity - **deleted_at** (string) - Time when the server deleted the entity - **is_email_notifications_enabled** (boolean) - Whether email notifications are enabled for this project - **is_plan_email_notifications_enabled** (boolean) - Whether notifications should be sent out on processing plans - **is_rfis_enabled** (boolean) - If this is a rfis enabled project template - **is_submittals_enabled** (boolean) - If submittals are enabled for the project template - **is_change_orders_enabled** (boolean) - If change orders are enabled on the project template - **is_budget_enabled** (boolean) - If budget are enabled on the project template - **prompt_effort_on_complete** (boolean) - Whether prompt to input effort should be shown on marking tasks as completed - **is_mobile_location_creation_enabled** (boolean) - If location creation on mobile is enabled for this project template - **min_verified_at_days** (integer) - Count of days after which verified tasks are archived - **sheets_limit** (integer) - Count of the latest sheet versions that should be cached on the mobile apps #### Response Example ```json { "project_template": { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "creator_user_id": 123, "last_editor_user_id": 123, "account_id": 456, "name": "My Project Template", "created_at": "2023-10-27T10:00:00Z", "deleted_at": null, "is_email_notifications_enabled": false, "is_plan_email_notifications_enabled": false, "is_rfis_enabled": true, "is_submittals_enabled": false, "is_change_orders_enabled": false, "is_budget_enabled": false, "prompt_effort_on_complete": true, "is_mobile_location_creation_enabled": true, "min_verified_at_days": 30, "sheets_limit": 10 } } ``` ``` -------------------------------- ### Get Project Tier Two Cost Codes - Ruby Example Source: https://developers.fieldwire.com/reference/tier-two-cost-codes Example Ruby code snippet using the 'httparty' gem to make a GET request for tier two cost codes. Shows how to set the request URL and headers. ```Ruby require 'httparty' url = 'https://client-api.us.fieldwire.com/api/v3/projects/project_id/tier_two_cost_codes' response = HTTParty.get(url, headers: { 'accept' => 'application/json', 'Fieldwire-Version' => 'YYYY-MM-DD' # Replace with actual date }) if response.success? puts response.parsed_response else puts "Error: #{response.code}" end ``` -------------------------------- ### GET /websites/developers_fieldwire_reference Source: https://developers.fieldwire.com/reference/get_floorplans_in_project Retrieves a list of projects with the ability to filter by name and update time. Includes pagination and user information in headers. ```APIDOC ## GET /websites/developers_fieldwire_reference ### Description Retrieves a list of projects, allowing filtering by name (like or equal to) and updated timestamp (greater than, less than, or equal to). The response includes pagination details and user information in the headers. ### Method GET ### Endpoint /websites/developers_fieldwire_reference ### Parameters #### Query Parameters - **filters[name_like]** (string) - Optional - Filter on the name field using a "like" comparison. - **filters[name_eq]** (string) - Optional - Filter on the name field using an "equals" comparison. Accepts an array of values. - **filters[updated_at_gte]** (string) - Optional - Filter on the `updated_at` field being greater than or equal to the provided ISO 8601 timestamp. - **filters[updated_at_gt]** (string) - Optional - Filter on the `updated_at` field being greater than the provided ISO 8601 timestamp. - **filters[updated_at_lte]** (string) - Optional - Filter on the `updated_at` field being less than or equal to the provided ISO 8601 timestamp. - **filters[updated_at_lt]** (string) - Optional - Filter on the `updated_at` field being less than the provided ISO 8601 timestamp. ### Request Example (No request body example provided for this GET endpoint) ### Response #### Success Response (200) - **id** (string) - Unique identifier for the project. - **creator_user_id** (integer) - The ID of the user who created the project. - **last_editor_user_id** (integer) - The ID of the user who last edited the project. - **project_id** (string) - The ID of the project. - **resolved_conflict** (boolean) - Indicates if conflicts have been resolved. - **created_at** (string) - ISO 8601 timestamp of when the project was created. - **updated_at** (string) - ISO 8601 timestamp of when the project was last updated. - **device_created_at** (string) - ISO 8601 timestamp of when the project was created on the device. - **device_updated_at** (string) - ISO 8601 timestamp of when the project was last updated on the device. - **deleted_at** (null) - Timestamp of deletion, if applicable. - **name** (string) - The name of the project. - **is_name_confirmed** (boolean) - Indicates if the project name has been confirmed. - **folder_id** (null) - The ID of the folder the project belongs to, if applicable. - **is_user_confirmed** (boolean) - Indicates if the user has confirmed the project. - **description** (null) - A description of the project. - **is_ocr_processing** (boolean) - Indicates if OCR processing is active for the project. - **active_sheets_count** (integer) - The number of active sheets within the project. - **process_state** (null) - The processing state of the project. - **cascade_deleted_by_id** (null) - The ID of the user who performed a cascade delete. - **deleted_by_two_way_sync** (boolean) - Indicates if the project was deleted by two-way sync. - **latest_component_device_updated_at** (string) - ISO 8601 timestamp of the latest component update on the device. - **sheets** (array) - An array of sheet objects associated with the project. - **id** (string) - Unique identifier for the sheet. - **creator_user_id** (null) - The ID of the user who created the sheet. - **last_editor_user_id** (null) - The ID of the user who last edited the sheet. - **project_id** (string) - The ID of the project the sheet belongs to. - **resolved_conflict** (boolean) - Indicates if conflicts have been resolved for the sheet. - **created_at** (string) - ISO 8601 timestamp of when the sheet was created. - **updated_at** (string) - ISO 8601 timestamp of when the sheet was last updated. #### Headers - **X-Current-User-Id** (integer) - The ID of the current user. - **X-Count** (integer) - The total number of entities in the response (for pagination). - **X-Last-Synced-At** (string) - ISO 8601 timestamp to be used for fetching the next page of results. - **X-Has-More** (boolean) - True if there are more pages of results, false otherwise. #### Response Example ```json [ { "id": "58fb800b-0dab-445a-9309-b32604b0ba36", "creator_user_id": 817, "last_editor_user_id": 817, "project_id": "a555dd41-4600-49fb-85c5-74ef3dab367f", "resolved_conflict": false, "created_at": "2025-11-12T02:39:15.212Z", "updated_at": "2025-11-12T02:39:15.247Z", "device_created_at": "2025-11-12T02:39:15.217Z", "device_updated_at": "2025-11-12T02:39:15.217Z", "deleted_at": null, "name": "floorplan 17", "is_name_confirmed": true, "folder_id": null, "is_user_confirmed": true, "description": null, "is_ocr_processing": false, "active_sheets_count": 1, "process_state": null, "cascade_deleted_by_id": null, "deleted_by_two_way_sync": false, "latest_component_device_updated_at": "1970-01-01T00:00:00.000Z", "sheets": [ { "id": "58313cc5-c5b7-4d2c-bfc7-04b34ce8d2c2", "creator_user_id": null, "last_editor_user_id": null, "project_id": "a555dd41-4600-49fb-85c5-74ef3dab367f", "resolved_conflict": false, "created_at": "2025-11-12T02:39:15.246Z", "updated_at": "2025-11-12T02:39:15.246Z" } ] } ] ``` ``` -------------------------------- ### Get Project Tier Two Cost Codes - Node.js Example Source: https://developers.fieldwire.com/reference/tier-two-cost-codes Example code snippet in Node.js using the 'axios' library to fetch tier two cost codes from a project. Demonstrates making a GET request with specified URL and headers. ```JavaScript const axios = require('axios'); const getTierTwoCostCodes = async (projectId, region = 'us') => { try { const response = await axios.get(`https://client-api.${region}.fieldwire.com/api/v3/projects/${projectId}/tier_two_cost_codes`, { headers: { 'accept': 'application/json', 'Fieldwire-Version': 'YYYY-MM-DD' // Replace with actual date } }); return response.data; } catch (error) { console.error('Error fetching tier two cost codes:', error); throw error; } }; // Example usage: // getTierTwoCostCodes('your_project_id').then(data => console.log(data)); ``` -------------------------------- ### Get Project Template Checklists (Python) Source: https://developers.fieldwire.com/reference/template-checklists Illustrates fetching template checklists using Python, likely with the 'requests' library. It covers setting the endpoint, headers, and handling the JSON response. ```python # Python example using the 'requests' library # import requests # # project_id = 'your_project_id' # region = 'your_region' # api_version = 'YYYY-MM-DD' # Replace with actual date # # url = f"https://client-api.{region}.fieldwire.com/api/v3/projects/{project_id}/template_checklists" # headers = { # 'accept': 'application/json', # 'Fieldwire-Version': api_version # } # # try: # response = requests.get(url, headers=headers) # response.raise_for_status() # Raise an exception for bad status codes # print(response.json()) # except requests.exceptions.RequestException as e: # print(f"Error fetching template checklists: {e}") ``` -------------------------------- ### Project Websites - Developers Fieldwire Reference Source: https://developers.fieldwire.com/reference/batch_add_template_check_items_for_template_checklist This section details the structure for project websites within the Developers Fieldwire Reference. ```APIDOC ## GET /websites/developers_fieldwire_reference ### Description Retrieves information about project websites within the Developers Fieldwire Reference. ### Method GET ### Endpoint /websites/developers_fieldwire_reference ### Parameters #### Query Parameters - **format** (string) - Optional - Specifies the desired output format (e.g., JSON, XML). ### Response #### Success Response (200) - **project_id** (string) - The unique identifier for the project. - **website_url** (string) - The URL of the project website. - **template_check_items_batch_input** (object) - Details about the batch input for template check items. - **type** (string) - The data type of the field. - **properties** (object) - Defines the properties of the template check items. - **id** (string) - Required - The unique identifier for the item. - **task_id** (string) - Required - The identifier for the associated task. - **status** (string) - Required - The current status of the item. - **device_created_at** (string) - Required - The timestamp when the item was created on the device. - **device_updated_at** (string) - Required - The timestamp when the item was last updated on the device. - **additionalProperties** (boolean) - Indicates if additional properties are allowed. ### Response Example ```json { "project_id": "proj_123", "website_url": "https://developers.fieldwire.com/projects/proj_123", "template_check_items_batch_input": { "type": "object", "properties": { "id": { "type": "string", "nullable": false }, "task_id": { "type": "string", "nullable": false }, "status": { "type": "string", "nullable": false }, "device_created_at": { "type": "string", "format": "date-time", "nullable": false }, "device_updated_at": { "type": "string", "format": "date-time", "nullable": false } }, "additionalProperties": false, "x-readme-ref-name": "template_check_items_batch_input" } } ``` ``` -------------------------------- ### Get All Change Orders - Ruby Request Example Source: https://developers.fieldwire.com/reference/change-orders Example Ruby code using the 'httparty' gem to fetch change orders. It shows how to set the request URL, headers, and process the JSON response. ```ruby require 'httparty' project_id = 'your_project_id' region = 'us' # e.g., 'us', 'eu' api_url = "https://client-api.#{region}.fieldwire.com/api/v3/projects/#{project_id}/change_orders" headers = { 'accept' => 'application/json', 'Fieldwire-Version' => 'YYYY-MM-DD', # Replace with the current date or desired API version 'Authorization' => 'Bearer YOUR_API_TOKEN' # Replace with your actual API token } begin response = HTTParty.get(api_url, headers: headers) if response.success? change_orders = response.parsed_response puts "Change Orders: #{change_orders}" else puts "Error fetching change orders: #{response.code} - #{response.message}" end rescue StandardError => e puts "An error occurred: #{e.message}" end ``` -------------------------------- ### Fetch Project Users (Node.js) Source: https://developers.fieldwire.com/reference/account-projects-users This Node.js example shows how to fetch project users using the 'axios' library. It constructs the request URL and headers, sending a GET request to the Fieldwire API and logging the response data. ```javascript const axios = require('axios'); const projectId = 'YOUR_PROJECT_ID'; // Replace with the actual project ID const apiUrl = `https://client-api.us.fieldwire.com/api/v3/account/projects/${projectId}/users`; axios.get(apiUrl, { headers: { 'accept': 'application/json' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching project users:', error); }); ``` -------------------------------- ### Get Project Template Checklists (Node.js) Source: https://developers.fieldwire.com/reference/template-checklists Demonstrates how to fetch template checklists using Node.js, likely with a library like 'axios'. It shows setting up the request URL, headers, and handling the response. ```javascript // Node.js example would go here, utilizing a fetch or axios library // const axios = require('axios'); // const projectId = 'your_project_id'; // const region = 'your_region'; // // axios.get(`https://client-api.${region}.fieldwire.com/api/v3/projects/${projectId}/template_checklists`, { // headers: { // 'accept': 'application/json', // 'Fieldwire-Version': 'YYYY-MM-DD' // Replace with actual date // } // }) // .then(response => { // console.log(response.data); // }) // .catch(error => { // console.error('Error fetching template checklists:', error); // }); ``` -------------------------------- ### Get Weather Conditions in Project (Python) Source: https://developers.fieldwire.com/reference/weather-conditions Python example using the requests library to get weather conditions. This code demonstrates making a GET request with specified headers and printing the JSON response. ```python import requests url = "https://client-api.us.fieldwire.com/api/v3/projects/project_id/weather_conditions" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Fetch Form Templates (Shell) Source: https://developers.fieldwire.com/reference/form-templates Example using cURL to make a GET request to the Fieldwire API for retrieving form templates within a specific project. This demonstrates the basic structure of an API call, including the URL and required headers. ```shell curl --request GET \ --url https://client-api.us.fieldwire.com/api/v3/projects/project_id/form_templates \ --header 'accept: application/json' ```