searchParts Procedure

The searchParts procedure searches for parts in the Parts Catalog.

Parameters

Here are the parameters of the searchParts procedure:
Parameter Name Mandatory Type Description
query Yes String Search query. Minimum length - 3 symbols (spaces symbols at the beginning and at the end are trimmed), maximum length - 100 symbols.
limit No Integer Maximum number of results returned as a result. Minimum value - 1, maximum - 1000. Default is 10.
cacheOnly No Boolean Whether the search is to be performed only in cache, or it can make a network request to finish the search. If set to true, the search is performed in offline mode without any network requests. Default is false.

Response

Here is the response for of the searchParts procedure:
Field Name Type Description
items Array Array of FoundItem objects. Found parts. Limited by the limit parameter.
source String Source of the search. Possible values:
  • "cache": The search is performed only in the cache, no network request is sent.

  • "server": The search is performed with a network request.

searchId Integer A unique id of the search procedure within the plug-in’s open session. Used as a parameter for the searchPartsContinue procedure.
isContinueAvailable Boolean Indicates whether the total number of results overflows the limit parameter or not. If it's true - then the searchPartsContinue procedure can be used to return more results (limited by the limit parameter).

foundItem Object Structure

Here is the structure of the foundItem object:
Field Name Type Parts Catalog API Parameter for ‘item’ Element of ‘upload_catalog’ Request Description
catalogId Integer None A unique identifier of a catalog.
itemId Integer None A unique identifier of a part within a catalog. Can be changed after catalog update.
label String label A unique identifier of a part within a catalog.
itemType String type Item type
inventoryType String None Label of a corresponding inventory type in Oracle Field Service. Can be empty if the mapping of item types to inventory types isn’t configured in the catalog schema. Mapping between itemType and inventoryType can be found in the typeSchemas field of the getPartsCatalogStructure procedure result.
fields Object fields An object (dictionary) that contains the item's fields by it's labels.
linkedItems Array linked_items Array of LinkedItem objects.
images Array images An array of strings, where each string is a URL of an image.

LinkedItem Object Structure

Here is the structure of the linkedItem object:
Field Name Type Parts Catalog API Parameter for ‘LinkedItem’ Element of ‘upload_catalog’ Request Description
id Integer None A unique identifier of a linked part within a catalog. Can be changed after catalog update.
label String label A unique identifier of a linked part within a catalog.
displayData String display_data Text comments to the linked item to be displayed in GUI.

Loading More Search Results

If the searchParts procedure returns isContinueAvailable as true, then you can load more search results through the searchPartsContinue method using the returned searchId. The searchPartsContinue method is available for 10 most recent searchId. The searchId values returned by the searchParts procedure are stored in a queue for 10 most recent calls that have isContinueAvailable = true. If the queue overflows, the searchId for the first calls are removed and searchPartsContinue isn't available for them any more. Each searchPartsContinue call moves it's searchId to the top of the queue (makes it most recent) and when searchPartsContinue returns isContinueAvailable as false, the searchId is removed from the queue.

Example of a Request
{
    "apiVersion": 1,
    "callId": "3quvGlWIgNJlQhHrYRN4vg==",
    "method": "callProcedure",
    "procedure": "searchParts",
    "params": {
        "query": "055",
        "limit": 5
    }
}
Example of a Response
{
    "apiVersion": 1,
    "method": "callProcedureResult",
    "callId": "3quvGlWIgNJlQhHrYRN4vg==",
    "resultData": {
        "items": [
            {
                "catalogId": 3,
                "itemId": 4179,
                "label": "XG9-0552-000",
                "itemType": "parts",
                "inventoryType": "PT",
                "linkedItems": [
                    {
                        "id": 4298,
                        "label": "D3625170",
                        "displayData": "9"
                    },
                    {
                        "id": 4547,
                        "label": "D5853100",
                        "displayData": "2"
                    },
                    {
                        "id": 4824,
                        "label": "D8093048",
                        "displayData": "8"
                    },
                    {
                        "id": 6310,
                        "label": "AB014229",
                        "displayData": "7"
                    }
                ],
                "fields": {
                    "description": "BEARING NP6560",
                    "vendor": "AGHA",
                    "cost": "5.704125031",
                    "price": "22.7",
                    "item_type": "NA",
                    "item_disposition": "NA"
                },
                "images": [
                    "https://example.com/picture/15.jpg",
                    "https://example.com/picture/10.jpg",
                    "https://example.com/picture/18.jpg",
                ]
            },
            {
                "catalogId": 3,
                "itemId": 5631,
                "label": "KHB670550A00",
                "itemType": "parts",
                "inventoryType": "PT",
                "linkedItems": [],
                "fields": {
                    "description": "KID-MOD MF16, TENSION-DETACK",
                    "vendor": "KODAK",
                    "cost": "742.5143066464",
                    "price": "1270.86",
                    "item_type": "NA",
                    "item_disposition": "NA"
                },
                "images": [
                    "https://example.com/picture/26.jpg"
                ]
            },
            {
                "catalogId": 3,
                "itemId": 5029,
                "label": "D0605507",
                "itemType": "parts",
                "inventoryType": "PT",
                "linkedItems": [
                    {
                        "id": 3972,
                        "label": "FB6-2374-000",
                        "displayData": "0"
                    },
                    {
                        "id": 4975,
                        "label": "B1253830",
                        "displayData": "8"
                    }
                ],
                "fields": {
                    "description": "PCB:B-C4B:SERVICE:ASS'Y",
                    "vendor": "HYTEC",
                    "cost": "1427.04",
                    "price": "2854.08",
                    "item_type": "BOARD",
                    "item_disposition": "Repairable"
                },
                "images": []
            },
            {
                "catalogId": 3,
                "itemId": 7551,
                "label": "D3305502",
                "itemType": "parts",
                "inventoryType": "PT",
                "linkedItems": [],
                "fields": {
                    "description": "[XREF TO HD3305502] DF MAIN BOARD",
                    "vendor": "NWRS",
                    "cost": "191.5",
                    "price": "480.95",
                    "item_type": "BOARD",
                    "item_disposition": "Repairable"
                },
                "images": [
                    "https://example.com/picture/2.jpg"
                ]
            },
            {
                "catalogId": 3,
                "itemId": 4203,
                "label": "D0746055",
                "itemType": "other",
                "inventoryType": "",
                "linkedItems": [
                    {
                        "id": 4037,
                        "label": "AB012067",
                        "displayData": "1"
                    }
                ],
                "fields": {
                    "description": "FLAT BELT-TRANSFER SERVICE PARTS",
                    "vendor": "SUNRISE",
                    "cost": "902.0665087976",
                    "price": "1848.46",
                    "item_type": "NA",
                    "item_disposition": "NA"
                },
                "images": [
                    "https://example.com/picture/26.jpg"
                ]
            }
        ],
        "isContinueAvailable": true,
        "source": "cache",
        "searchId": 1
    }
}