Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Inventory API Query

Sample Query for Inventory Items

Samples are using Postman to send requests<Rockstar description here>

How to get the Bearer Token

Request URL: https://go.solarplus.co/graphqlAuthorization: Integration → Solarplus API Credentials Token

...

  • Paste it as Graphql’s authorization access

...

Testing Graphql via

...

On the right, see documentation of app structure:

eg.

...

postman

  • Set the bearer token from the collection settings

    Image Added
  • Create a POST request from the request URL above

  • Set the body as GraphQL and formulate a query

  • Perform a request

...

Testing Graphql via browser

On the right, see documentation of app structure:

eg.

{ Inventory(id: 87381 )

{

id
name
InventoryPricings {

item_variation_suffix
unitPrice

}

}
}

...

CREATE (POST) requests

Create Inventory :

category_id -  required field ( check possible values at the end of this post)

brand_id - required field for specific categories ( check end of post for categories which require brand_id)

model_id - required field for specific categories ( check end of post for categories which require model_id)

name - required field  

item is purchased - boolean value 0( false) or 1( true)

include in quote by default - boolean value 0( false) or 1( true)

assign kit value - boolean value 0( false) or 1( true)

description - text description

apply sales tax - applicable only to SUBSIDY ( CAT. 18)

subtract from payable - applicable only to SUBSIDY ( CAT. 18)

Create Inventory Kit ( with Pricing )

mutation: gql` mutation createInventoryKitItem( $input: CreateInventoryKitInput! ) { createInventoryKitItem(input: $input) } `, variables,

  1. Create Pricing Level:

VARIABLES:

...

METHOD:

savePricing

...

VARIABLES:

...

METHOD:

createInventory

NOTE:

  • method returns the Inventory that has been created, kindly check the end of the page for the available fields on Inventory model

  • some categories will require model ( foriegn_id) field

  • some categories also have a default value for 'Cost of Sales Inc’

more information to this is added at the end of the page

...


  1. Create Pricing Level:

VARIABLES:


note: same method is used for update pricing, to create a new one , supply id with value 0, or do not pass field id

...


METHOD:

savePricing

...

Create Pricing without SKU and Supplier

...

NOTES:

  • if is_default is not specified for the pricing, it is automatically set to true

  • if no supplier and SKU is provided for the pricing, an SKU is automatically generated for the pricing. This is usually the case for Inventories under service categories.

UPDATE ( POST ) Requests

Update Inventory

inventory_id - required field

category_id -  ( check possible values at the end of this post)

brand_id - required field for specific categories ( check end of post for categories which require brand_id)

model_id - required field for specific categories ( check end of post for categories which require model_id)

name - required field  

item is purchased - boolean value 0( false) or 1( true)

include in quote by default - boolean value 0( false) or 1( true)

assign kit value - boolean value 0( false) or 1( true)

description - text description

apply sales tax - applicable only to SUBSIDY ( CAT. 18)

subtract from payable - applicable only to SUBSIDY ( CAT. 18)

UPDATE PRICING

VARIABLES:

...

METHOD:

savePricing

...

DELETE REQUEST

DELETE INVENTORY

...

DELETE PRICING

VARIABLES :

id : required, inventory id to be deleted

METHOD:

deleteInventoryByPk

...

SEARCH (POST) REQUEST 

Search Inventory

METHOD:

Inventories

VARIABLES FOR INPUT (ARGUMENTS) :

...

VARIABLES FOR OUTPUT (DATA):

...

SAMPLE QUERY:

...

QUERY :

...

VARIABLES:

...

METHOD:

updateInventory

Image Added

UPDATE PRICING

VARIABLES:

...


METHOD:

savePricing

...

DELETE REQUEST

DELETE INVENTORY

VARIABLES :

id : required, inventory id to be deleted

METHOD:

deleteInventoryByPk

...

DELETE PRICING

VARIABLES :

id : required, inventory id to be deleted

METHOD:

deleteInventoryByPk

...

SEARCH (POST) REQUEST 

Search Inventory

METHOD:

Inventories

VARIABLES FOR INPUT (ARGUMENTS) :

...

VARIABLES FOR OUTPUT (DATA):

...

SAMPLE QUERY:

...

QUERY :

Code Block
query Inventories(
                        $archived: Boolean
                        $categoryId: ID
                        $orderBy: String
                        $orderType: String
           $archived: Boolean            $businessId: ID
           $categoryId: ID        ) {
               $orderBy: String        Inventories(
                $orderType: String           archived: $archived
            $businessId: ID               categoryId: $categoryId
    ) {                       orderBy: $orderBy
Inventories(                             archivedorderType: $archived$orderType
                            categoryIdbusinessId: $businessId
$categoryId                        ) {
    orderBy: $orderBy                       id
     orderType: $orderType                      name
      businessId: $businessId                     Category {
  ) {                             id
                            name    name
                        Category {   }
                            series_and_model
 id                           inventory_currency
     name                       brand_name
     }                       kit_value
     series_and_model                       archived
     inventory_currency                       InventoryPricingDefault {
    brand_name                            id
 kit_value                             archived  code
                          InventoryPricingDefault {     markup_is_percentage
                           id     markup_is_percentage_text
                           code     markup_value
                           markup_is_percentage     unit_price
                           markup_is_percentage_text     retail_price
                           markup_value     Supplier {
                          unit_price          id
                      retail_price              name
                  Supplier {             }
                       id         item_variation_suffix
                           name }
                        }
      }              }

SAMPLE INPUT :

Code Block
{
    "archived": false,
    

...

"categoryId": 8,
    

...

"orderBy" : "updated",
    "orderType" : "DESC",
    "businessId" : 911
}


SAMPLE OUTPUT:

Code Block
{
    "data": {
      

...

  "Inventories": [
            {
         

...

       "id": "42289",
            

...

SAMPLE INPUT :

Code Block
{
    "archivedname": false, "neon genesis evangelion",
       "categoryId": 8,       "orderBy" : "updatedCategory",: {
   "orderType" : "DESC",     "businessId" : 911 }
SAMPLE OUTPUT:
Code Block
{       "dataid": {"8",
        "Inventories": [             {"name": "Modules"
                "id": "42289"},
                "nameseries_and_model": "neon genesis evangelionRSM72-6-315P",
                "Categoryinventory_currency": {"$",
                    "id"brand_name": "8Risen",
   
                "namekit_value": "Modules"false,
                "archived": }false,
                "series_and_modelInventoryPricingDefault": "RSM72-6-315P", {
                    "inventory_currencyid": "$24466",
                    "brand_namecode": "Risenneon genesis evangelion",
                    "kitmarkup_is_valuepercentage": false,"1",
                    "archivedmarkup_is_percentage_text": false,"%",
                    "InventoryPricingDefaultmarkup_value": {12,
                    "idunit_price": "24466"0,
                    "coderetail_price": "neon genesis evangelion",
0,
                    "markup_is_percentageSupplier": "1", {
                        "markup_is_percentage_textid": "%2848",
                    "markup_value    "name": 12,"sdwewewew"
                    "unit_price": 0},
                    "retailitem_variation_pricesuffix": 0,"test2"
                }
   "Supplier": {        },
          ]
     "id": "2848",
}
}

Search Inventory Pricing

VARIABLES FOR INPUT (ARGUMENTS) :

...

VARIABLES FOR OUTPUT(DATA):

...

SAMPLE QUERY:

...

QUERY:

Code Block
  query InventoryPricings(
                       "name": "sdwewewew" $inventoryId: ID
                    ) {
           },             InventoryPricings(
       "item_variation_suffix": "test2"                 }   inventoryId: $inventoryId
        },           ]     }
}

Search Inventory Pricing

Stock code- varchar

Supplier_name - varchar

Supplier_id - numeric

Buy Price - numeric 

inventory_id - numeric

is default - boolean value 0( false) or 1( true)

buy price - numerical value

unit_of_measure - numeric ( check end of the post for possible values )  

markup value - numerical value

markup value is percent - boolean value 0( false) or 1( true)

Order_by - column or columns to order the entries ( default is updated_date)
Order_type - DESC or ASC

Get specific inventory item

Inventory_id - required field

Get specific pricing

Pricing_id - required field

Brand query

Category_id - optional

Model query

Category_id - required

Brand_id - required

) {
                            id
                            inventory_id
                            supplier_id
                            code
                            unit_price
                            markup_value
                            markup_is_percentage
                            unit_of_measure_string
                            unit_of_measure
                            item_variation_suffix
                            spare_qty
                            quantity
                        }
                    }


SAMPLE INPUT :

Code Block
{
    "inventoryId": 29505
}

SAMPLE OUTPUT:

Code Block
{
    "data": {
        "InventoryPricings": [
            {
                "id": "24399",
                "inventory_id": "29505",
                "supplier_id": "293",
                "code": "ET Solar ET-M572190",
                "unit_price": 2,
                "markup_value": 12,
                "markup_is_percentage": "1",
                "unit_of_measure_string": "/ kW Solar PV",
                "unit_of_measure": "2",
                "item_variation_suffix": "",
                "spare_qty": 0,
                "quantity": 0
            },
            {
                "id": "15459",
                "inventory_id": "29505",
                "supplier_id": null,
                "code": "ET-M572190",
                "unit_price": 200,
                "markup_value": 12,
                "markup_is_percentage": "1",
                "unit_of_measure_string": "/ item",
                "unit_of_measure": "0",
                "item_variation_suffix": "",
                "spare_qty": 0,
                "quantity": 0
            }
        ]
    }
}


IMPORTANT DATA :

INVENTORY MODEL:

Image AddedImage Added

CATEGORY VALUES 


1 Mounting

2 Isolators - DC

...

23 Battery Isolator

24 Energy Management

25 Discount

26 Contractor install kits

27 Safety & access equipment

CATEGORIES THAT REQUIRE BRAND AND MODEL:

7 Inverters

8 Modules

17 Battery

CATEGORIES

...

THAT ACCEPT BRAND AND MODEL BUT DO NOT REQUIRE IT :

5 Accessories

20 Battery Access

...

13 Miscellaneous

6 Monitoring

1 Mounting

CATEGORIES THAT THE DEFAULT VALUE FOR COST OF SALES IS FALSE:

9 Labour

10 Difficulty surcharges

11 Travel/Freight

12 Administrative

13 Miscellaneous

15 Warranty

18 Subsidy

25 Discount