zaepho.zohobooks.zohobooks_item_info module – Retrieve ZohoBooks items information

Note

This module is part of the zaepho.zohobooks collection (version 0.3.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install zaepho.zohobooks.

To use it in a playbook, specify: zaepho.zohobooks.zohobooks_item_info.

New in zaepho.zohobooks 0.2.0

Synopsis

  • Retrieve information about items in ZohoBooks

  • Can retrieve a specific item by name or ID, or list all items

Parameters

Parameter

Comments

access_token

string

ZohoBooks API access token

Can also be set via ZOHO_ACCESS_TOKEN environment variable

api_domain

string

ZohoBooks API domain

Can also be set via ZOHO_API_DOMAIN environment variable

Default: "https://www.zohoapis.com"

filter_by

string

Filter items by status

Choices:

  • "Status.Active"

  • "Status.Inactive"

  • "Status.All"

item_id

string

ID of the item to retrieve

Mutually exclusive with name

name

string

Name of the item to retrieve

Mutually exclusive with item_id

organization_id

string

ZohoBooks organization ID

Can also be set via ZOHO_ORGANIZATION_ID environment variable

sku

string

SKU of the item to retrieve

Mutually exclusive with name and item_id

Examples

- name: Get all items
  zaepho.zohobooks.zohobooks_item_info:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
  register: all_items

- name: Get item by name
  zaepho.zohobooks.zohobooks_item_info:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    name: "Hard Drive"
  register: item

- name: Get item by ID
  zaepho.zohobooks.zohobooks_item_info:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    item_id: "987654321"
  register: item

- name: Get item by SKU
  zaepho.zohobooks.zohobooks_item_info:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    sku: "HD-500GB-001"
  register: item

- name: Get all active items
  zaepho.zohobooks.zohobooks_item_info:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    filter_by: "Status.Active"
  register: active_items

- name: Get items using environment variables
  zaepho.zohobooks.zohobooks_item_info:
    name: "Software License"
  environment:
    ZOHO_ORGANIZATION_ID: "123456789"
    ZOHO_ACCESS_TOKEN: "your_access_token"
    ZOHO_API_DOMAIN: "https://www.zohoapis.com"
  register: item

- name: Display item information
  debug:
    var: item.zohobooks_items

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

count

integer

Number of items returned

Returned: always

Sample: 1

zohobooks_items

list / elements=dictionary

List of items matching the criteria

Returned: always

Sample: [{"description": "500GB Hard Drive", "item_id": "123456789", "item_type": "sales", "name": "Hard Drive", "product_type": "goods", "rate": 120.0, "sku": "HD-500GB-001", "status": "active", "tax_id": "987654321", "tax_name": "Sales Tax", "tax_percentage": 10, "track_inventory": false, "unit": "unit"}]

Authors

  • Kevin Colby (@zaepho)