Skip to content

Instantly share code, notes, and snippets.

@pmdeazeta
Last active September 3, 2018 02:27
Show Gist options
  • Save pmdeazeta/04768ad829ec154361b4ad4ed8e7d83d to your computer and use it in GitHub Desktop.
Save pmdeazeta/04768ad829ec154361b4ad4ed8e7d83d to your computer and use it in GitHub Desktop.
Non-public-API.rb
### Create new product
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/products/ -d '{"product":{"name":"Pucci","opt1":"Colour","supplier_ids": [9035460], "variants":[{"name": "Pucci1", "opt1": "RED", "initial_stock_level": 100, "initial_cost_price": 50, "retail_price": 30, "variant_prices":[{"price_list_id": "249", "value": "43"}]}]}}'
{"product":
{
"name":"Pucci",
"opt1":"Colour",
"supplier_ids": [9035460],
"variants":[
{
"name": "Pucci1",
"opt1": "RED",
"initial_stock_level": 100,
"initial_cost_price": 50,
"retail_price": 33,
"variant_prices":[
{"price_list_id": 249, "value": 43}
]
}
]
}
}
### Update New Company
curl -X PUT -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/companies/9035460 -d '{"company":{"tags":["123","33"],"description":"3333","name":"Pucci Supplier","company_type":"supplier","company_code":"123123","tax_number":"1232","status":"active","default_price_list_id":"buy","default_tax_type_id":"52063","default_stock_location_id":"23278","default_document_theme_id":"61900","assignee_id":"1339"}}'
{"company":
{
"tags":["ABC","DEF"],
"description":"Test",
"name":"Pucci Supplier",
"company_type":"supplier",
"company_code":"123123",
"tax_number":"1232",
"status":"active",
"default_price_list_id":"buy",
"default_tax_type_id":"52063",
"default_stock_location_id":"23278",
"default_document_theme_id":"61900",
"assignee_id":"1339"
}
}
### Create new contact
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/contacts -d '{"contact":{"email":"pucci@cat.com","fax":"12345","first_name":"Pucci","last_name":"Santos","location":"Engg","mobile":"123456","notes":"Test","phone_number":"1234","position":"Owner","company_id":"9035460"}}'
{"contact":
{
"email":"pucci@cat.com",
"fax":"12345",
"first_name":"Pucci",
"last_name":"Santos",
"location":"Engg",
"mobile":"123456",
"notes":"Test",
"phone_number":"1234",
"position":"Owner",
"company_id":"9035460"
}
}
### Creating a Purchase Order
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/purchase_orders -d '{"purchase_order":{"email":"cat@cat.com","status":"active","order_number":null,"reference_number":"REF123","notes":"Message","due_at":"2016-7-28","tax_treatment":"exclusive","company_id":"9035460","supplier_address_id":"10878840","stock_location_id":"75770","billing_address_id":"42260","default_price_list_id":"buy","currency_id":"4", "purchase_order_line_items":[{ "quantity":100, "price":50, "variant_id":"19724573", "tax_type_id":"52063" }]}}'
{"purchase_order":
{
"email":"cat@cat.com",
"reference_number":"REF123",
"notes":"Message",
"due_at":"2016-7-28",
"tax_treatment":"exclusive",
"company_id":"9035460",
"supplier_address_id":"10878840",
"stock_location_id":"75770",
"billing_address_id":"42260",
"default_price_list_id":"buy",
"currency_id":"4",
"purchase_order_line_items":[
{
"quantity":100,
"price":50,
"variant_id":"19724573",
"tax_type_id":"52063"
}
]
}
}
### Updating a purchase order
curl -X PUT -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/purchase_orders/346463 -d '{"purchase_order":{"email":"cat@cat.com","status":"active","order_number":null,"reference_number":"REF123","notes":"Message","due_at":"2016-7-28","tax_treatment":"exclusive","company_id":"9035460","supplier_address_id":"10878840","stock_location_id":"75770","billing_address_id":"42260","default_price_list_id":"buy","currency_id":"4", "purchase_order_line_items":[{ "quantity":100, "price":50, "variant_id":"19724573", "tax_type_id":"52063" }]}}'
{"purchase_order":
{
"email":"cat@cat.com",
"reference_number":"REF123",
"notes":"Message",
"due_at":"2016-7-28",
"tax_treatment":"exclusive",
"company_id":"9035460",
"supplier_address_id":"10878840",
"stock_location_id":"75770",
"billing_address_id":"42260",
"default_price_list_id":"buy",
"currency_id":"4",
"purchase_order_line_items":[
{
"quantity":100,
"price":50,
"variant_id":"19724573",
"tax_type_id":"52063"
}
]
}
}
### Receiving a purchase order
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/procurements/ -d '{"procurement":{"received_at":"Thu, 14 Jul 2016 15:59:08 GMT","exchange_rate":1,"purchase_order_id":"346469","purchase_order_line_items":[{"id":"2520605"}]}}'
{"procurement":
{
"received_at":"Thu, 14 Jul 2016 15:59:08 GMT",
"exchange_rate":1,
"purchase_order_id":"346469",
"purchase_order_line_items":[
{"id":"2520605"}
]
}
}
### Create Stock Transfer
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_transfers -d '{"stock_transfer":{"source_location_id":"75770","destination_location_id":"76675","stock_transfer_line_items":[{"quantity":30,"position":0,"variant_id":"19724573"}]}}'
{"stock_transfer":
{
"source_location_id":"75770",
"destination_location_id":"76675",
"stock_transfer_line_items":[
{"quantity":30,"position":0,"variant_id":"19724573"}
]
}
}
### Receive stock transfer
curl -X PUT -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_transfers/169596 -d '{"stock_transfer":{"status":"received"}}'
{"stock_transfer":
{
"status":"received"
}
}
### Creating Stock Adjustment
LABEL_MAP = {
supplier: 'New Products',
customer: 'Returned',
damaged: 'Damaged',
shrinkage: 'Shrinkage',
promotion: 'Promotion',
production: 'Production',
stocktake: 'Stocktake',
}
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_adjustments -d '{"stock_adjustment":{"reason":"supplier","stock_location_id":"75770","stock_adjustment_line_items":[{"quantity":90,"price":50,"variant_id":"19724573"}]}}'
{"stock_adjustment":
{
"reason":"supplier",
"stock_location_id":"75770",
"stock_adjustment_line_items":[
{"quantity":90,"price":50,"variant_id":"19724573"}
]
}
}
### Getting a list of stock adjustments
### https://api.tradegecko.com/stock_adjustments
curl -X GET -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_adjustments
### Getting a specific stock adjustment
### https://api.tradegecko.com/stock_adjustments/526454
curl -X GET -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_adjustments/526454
### Getting a multiple stock adjustments by id
### https://api.tradegecko.com/stock_adjustments?ids[]=526450&ids[]=526453&ids[]=526454
curl -X GET -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_adjustments?ids[]=526450&ids[]=526453&ids[]=526454 --globoff
### Getting a specific stock adjustment line item
### https://api.tradegecko.com/stock_adjustment_line_items/3680115
curl -X GET -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_adjustment_line_items/3680115
### Getting a multiple stock adjustment line items by id
### https://api.tradegecko.com/stock_adjustment_line_items?ids[]=3680102&ids[]=3680114&ids[]=3680115
curl -X GET -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/stock_adjustment_line_items?ids[]=3680102&ids[]=3680114&ids[]=3680115 --globoff
### Create webhook
### Available Events
# EVENTS = %w[
# account.update
# address.create
# address.update
# company.create
# company.update
# contact.create
# contact.update
# document_theme.update
# fulfillment.create
# fulfillment_return.create
# iguana_channel.update
# invoice.create
# location.create
# location.update
# order.create
# payment.create
# product.create
# procurement.create
# purchase_order.create
# stock_adjustment.create
# stock_transfer.create
# stripe_connect_channel.create
# stripe_connect_channel.update
# variant.create
# variant_image.create
# ]
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/webhooks -d '{"webhook":{"address":"http://localhost:3000/webhooks": ,"event":"product.create"}}'
### Update Webhook
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/webhooks/1 -d '{"webhook":{"address":"http://localhost:3000/webhooks": ,"event":"product.create"}}'
### Delete webhook
curl -X DELETE -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/webhooks/1
### List all webhooks
curl -X GET -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/webhooks
### Get specific webhook
curl -X GET -H "Content-type: application/json" -H "Authorization: Bearer 7f2ba72ae693b57e18" https://api.tradegecko.com/webhooks/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment