Inventory API Documentation

Inventory API Documentation

 

 

Inventory API Query

The inventory API provides access to in SolarPlus Inventory pricebook for the business account where you can access and update products, stock codes, pricing, suppliers and much more.

How to get the Bearer Token

Request URL: https://go.solarplus.co/graphql

  • Get the bearer token by generating a Secret Key in the SolarPlus.

    • Go to More Settings > Admin > User Preferences > Integrations

    • Open the top section, SolarPlus API credentials

    • Click Generate New Secret Key

image-20250324-050131.png
  • Paste it as Graphql’s authorization access

 

Testing Graphql via postman

  • Set the bearer token from the collection settings

  • 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 :

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

VARIABLES:

 

METHOD:

updateInventory

 

 

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 :

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

SAMPLE INPUT :

 

{ "archived": false, "categoryId": 8, "orderBy" : "updated", "orderType" : "DESC", "businessId" : 911 }


SAMPLE OUTPUT:

 

{ "data": { "Inventories": [ { "id": "42289", "name": "neon genesis evangelion", "Category": { "id": "8", "name": "Modules" }, "series_and_model": "RSM72-6-315P", "inventory_currency": "$", "brand_name": "Risen", "kit_value": false, "archived": false, "InventoryPricingDefault": { "id": "24466", "code": "neon genesis evangelion", "markup_is_percentage": "1", "markup_is_percentage_text": "%", "markup_value": 12, "unit_price": 0, "retail_price": 0, "Supplier": { "id": "2848", "name": "sdwewewew" }, "item_variation_suffix": "test2" } }, ] } }

Search Inventory Pricing

VARIABLES FOR INPUT (ARGUMENTS) :

 

VARIABLES FOR OUTPUT(DATA):

 

SAMPLE QUERY:

 

QUERY:

 

query InventoryPricings( $inventoryId: ID ) { InventoryPricings( inventoryId: $inventoryId ) { 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 :

 

{ "inventoryId": 29505 }

 

SAMPLE OUTPUT:

 

{ "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:

 

 

CATEGORY VALUES 



1 Mounting

2 Isolators - DC

3 Fuses/Breakers

4 Cables

5 Accessories

6 Monitoring

7 Inverters

8 Modules

9 Labour

10 Difficulty surcharges

11 Travel/Freight

12 Administrative

13 Miscellaneous

14 Kit

15 Warranty

16 Isolators - AC

17 Battery

18 Subsidy

19 Metering

20 Battery Access

21 Grid Protection

22 Generator

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

23 Battery Isolator

4 Cables

24 Energy Management

3 Fuses/Breakers

22 Generator

21 Grid Protection

16 Isolators - AC

2 Isolators - DC

14 Kit

19 Metering

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