#Inkmonk - python client#
The Python client for interacting with the Inkmonk API hosted at https://inkmonk.in/api/v1
-
Download the zip file.
-
Run
python setup.py install
. -
Set api key and secret key as follows,
import inkmonk inkmonk.config.API_KEY='4f52176c7b894a9ab5a15777feeba02124022015190803287306' inkmonk.config.API_SECRET='a63421f75f9b4bb58fb3ae63fffbfd9024022015190803287405'
-
Start using
inkmonk.Merchandise.all()
Alternatively you can also set the API KEY and API_SECRET in the config.py file itself after step 1 and do only step 2. You can then start using it without having to set programmatically.
The following classes are available
- Merchandise
- SKU
- Tshirt
- Claim
- Campaign
- Shipment
For all these classes you have the following methods available
-
create
c=Campaign.create( slots=[{'quantity': 1, 'choices': [sk.id for sk in sks]}], campaign_title="This is a new campaign", customers=['surya@stickystamp.com'], template_body="Hello", template_header="Heading", form_title="Awesome Title")
-
all
tshirts = inkmonk.Tshirt.all() for t in tshirts: print t.name
-
get
tee = inkmonk.Tshirt.get('U1-C81C-TS-RNE-CO')
-
update
tee_updated = inkmonk.Tshirt.update('U1-C81C-TS-RNE-CO', color="Navy Blue")
-
patch
Apart from these methods, you can also directly use the core HTTP methods on specific endpoints if the structure is non standard REST ( for internal use ) The following core methods are present
- get
- all
- post
- put
- patch
Eg: inkmonk.core.all('tshirts')
You can pass the query params like this
inkmonk.core.all('skus', params = {'categorized': 'old'})
If you really really dont want any of the fancy classes and want just the raw response, you can still do it by passing raw=True to the core methods.
response = inkmonk.core.all('skus', raw=True)