Skip to main content

A python client library for Newgistics Web API and Fulfillments API

Project description

alt text Newgistics Python Client

PyPI version

image image image image

Python Client for Newgistics Fulfillments API v2.8.2 and Newgistics Web API v2.2. Please refer to the API docs before using this package.

Installation

Supports Python 3+ To install, simply use pip

$ sudo pip install newgistics
✨🍰✨

Usage

Newgistics Fulfillments System API
>>> from newgistics import NewgisticsFulfillment

>>> ngf_client = NewgisticsFulfillment(api_key='<NG-Fulfillments-API-Key>', staging=False)
>>> ngf_client.inbound_returns.create(payload=request_payload)
    <Response [200]>
Newgistics REST Web API
>>> from newgistics import NewgisticsWeb

>>> ngw_client = NewgisticsWeb(api_key='<NG-Web-API-Key>', staging=False)
>>> ngw_client.labels.create(payload=label_payload)
    <Response [200]>

You can pass the api_key explicitly. Alternatively, you may declare these environment variables NG_FL_API_KEY and/or NG_WEB_API_KEY.

For wrapper usage code snippets please check examples.py

Features

Note: Below package usages return a requests module's Response object. Append .json() to get a python dictionary response

  • Newgistics Fulfillments
    • Shipments
      • Create Shipment
        >>> request_payload = {'Orders': 
                {'Order': {'AllowDuplicate': False,
                           'CustomerInfo': {'Address1': '32142 Waverton Lane',
                            'Address2': None,
                            'City': 'Huntersville',
                            'Company': None,
                            'Country': 'US',
                            'Email': 'yestestmail@gmail.com',
                            'FirstName': 'John',
                            'IsResidential': 'true',
                            'LastName': 'Barron',
                            'Phone': None,
                            'State': 'NC',
                            'Zip': '28078'},
                           'HoldForAllInventory': False,
                           'Items': {'Item': [{'Qty': 10, 'SKU': 'HLU'}]},
                           'OrderDate': '04-12-2019',
                           'RequiresSignature': False,
                           'id': '4321'}}}
        >>> ngf_client.shipments.create(payload=request_payload)
        
        Submit orders to WMS system
      • Fetch Shipment(s)
        >>> ngf_client.shipments.fetch(params={'id': '4231'})
        
        Retrieves a list of shipments based on one or more parameters
    • Inbound Returns
      • Create Inbound Return
        >>> request_payload = {'Returns': {
                                  'Return': {'id': '8732832',
                                   'Comments': 'COMMENTS',
                                   'Items': {'Item': [{'Qty': 10, 'Reason': 'Some_Reason', 'SKU': 'HLU'}]},
                                   'RMA': '1234'}}}
        >>> ngf_client.inbound_returns.create(payload=request_payload)
        
        Submits incoming returns by RMA ID to the WMS system
      • Fetch Inbound Return(s)
        >>> ngf_client.inbound_returns.fetch(params={'startCreatedTimestamp': '', 'endCreatedTimestamp': ''})
        
        Retrieves a list of incoming returns by RMA ID to the WMS system
    • Returns
      • Fetch Return(s)
        >>> ngf_client.returns.fetch(params={'Id': '1234'})
        
        Retrieves a list of returns received by Newgistics Fulfillment for a given date/time range or a specific return by order ID
  • Newgistics Web API
    • Shipments
      • Create Shipment Label
        >>> payload = {
        "clientServiceFlag": "Standard",
        "consumer": {
            "Address": {
                "Address1": "2700 Via Fortuna Drive",
                "Address2": "",
                "Address3": "",
                "City": "Austin",
                "CountryCode": "US",
                "State": "TX",
                "Zip": "78746"
            },
            "DaytimePhoneNumber": "5122256000",
            "EveningPhoneNumber": "",
            "FaxNumber": "",
            "FirstName": "testname",
            "Honorific": "",
            "LastName": "tester",
            "MiddleInitial": "",
            "PrimaryEmailAddress": "croosken@newgistics.com"
        },
        "deliveryMethod": "SelfService",
        "dispositionRuleSetId": 99,
        "labelCount": 1,
        "merchantID": "NGST",
        "returnId": "123456789A"
        }
        >>> ngw_client.labels.create(payload=payload)
        
        Creates a SmartLabel return label

Default Values

About Newgistics

Newgistics provides services and technology to support the e-commerce operations of retailers around the world. Its offerings include software and services to build and maintain e-commerce websites, perform order fulfillment, and manage parcel delivery and returns. This package reduces the shortcomings/difficulties whule integrating Newgistics's APIs. It's still not what I'd appreciate, but it should just work! Looking for your active contribution to the project (See roadmap below)

Support

For any wrapper related query/issue, please raise a GitHub issue.

About

Why

Integrating with 3PL APIs like Newgistics(owned by PitneyBowes) can be pain at times. For instance, some APIs are XML only, whereas some can accept JSON as payload but return a XML response

RoadMap/Shortcomings

1. Write Tests with a token from Newgistics(Observation: staging and production tokens are same on NG)
2. Cover more APIs from both Web & Fulfillment
3. Return better objects, eg: every function returns a python requests's Response object
4. Overall code and design improvements 

Sameer Kumar

Find me on Twitter

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

newgistics-0.2.tar.gz (7.4 kB view details)

Uploaded Source

File details

Details for the file newgistics-0.2.tar.gz.

File metadata

  • Download URL: newgistics-0.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

File hashes

Hashes for newgistics-0.2.tar.gz
Algorithm Hash digest
SHA256 21979467349e42134c5590cdb0fb717bafd7021bbb2fa7f4ef9c44dce39ba460
MD5 3764418b914650d72bfed9d2246568bd
BLAKE2b-256 001f2f6259e3be6dfbbf2a3b8e88bb643fed9200e2daf3c458f9af8653590f10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page