Norsani API
Last updated
Was this helpful?
Last updated
Was this helpful?
Norsani API was developed to allow access to Norsani resources through REST calls. To use the Norsani API you must download and activate the .
You can use any programming language your prefer to connect with the API.
React Native developers can use the package to easily connect with the API over HTTP or HTTPS.
Norsani 2.14+
WooCommerce 3.6+.
WordPress 4.4+.
Pretty permalinks in Settings > Permalinks
so that the custom endpoints are supported. Default permalinks will not work.
You may access the API over either HTTP or HTTPS, but HTTPS is recommended where possible. Norsani uses the WooCommerce API customer key and secret to authenticate so before you start you should obtain your WooCommerce API keys from WooCommerce settings -> Advance -> REST API.
You may use by providing the REST API Consumer Key as the username and the REST API Consumer Secret as the password in the request's Authorization header.
Occasionally some servers may not parse the Authorization header correctly (if you see a "Consumer key is missing" error when authenticating over SSL, you have a server issue). In this case, you may provide the consumer key/secret as query string parameters instead.
GET
https://yourwebsite.com/wp-json/norsani/v1/loadappdata
This is called to load a list of all vendors but also returns other data sets. Please see the call response for more information.
vendortype
string
Vendor type to retrieve. Pass null to get all types.
ordertype
string
User selected order type. Pass null to get all types.
customer
string
Current user's email address.
locality
string
User selected locality.
GET
https://yourwebsite.com/wp-json/norsani/v1/get_vendor/id
Returns resources of a single vendor.
id
integer
Id of the vendor to return.
GET
https://yourwebsite.com/wp-json/norsani/v1/getproduct/id
id
integer
id of the product to return.
GET
https://yourwebsite.com/wp-json/norsani/v1/searchvendors
Search vendors by keyword. This will search for the keyword within the vendor name, tags, and address.
vendortype
string
Type of vendors to search. pass null to search all.
ordertype
string
Search vendors that offer this order type. Pass null to search all.
keyword
string
Search keyword
GET
https://yourwebsite.com/wp-json/norsani/v1/localityoptions
Will get the locality options available on the website. This endpoint does not accept any parameters.
GET
https://yourwebsite.com/wp-json/norsani/v1/getfavoritevendors
ids
string
A comma separated string of vendor ids.
GET
https://yourwebsite.com/wp-json/norsani/v1/getfavoriteitems
ids
string
A comma separated list of product ids.
GET
https://yourwebsite.com/wp-json/norsani/v1/getorders
Get a list of the user previous orders.
string
numberorders
integer
Number of orders to get
GET
https://yourwebsite.com/wp-json/norsani/v1/getorder/id
id
integer
Id of the order to get.
POST
https://yourwebsite.com/wp-json/norsani/v1/addtocart
This uses the WooCommerce frontend cart functions to calculate totals, so you always get the up to date accurate cart totals collection on your app. This does not save any data on the server so each time you add a product to cart you should also send the previous cart data.
cartData
array
Array of cart data to be send as request. array( vendor_id => array( 'items' => array( productID => imagelink => variationID => qty => orderType => specialNotes => variations => // If not applicable set null price => name => maxOrders => remainingOrders => minQty => ), ), ... )
coupons
array
Array of coupon codes to apply.
POST
https://yourwebsite.com/wp-json/norsani/v1/getcheckoutform
This will get the checkout form fields as required on the website in addition to the checkout order review and totals.
cartData
array
Cart data as sent in the Add to Cart request.
coupons
array
Array of coupon codes used in cart.
orderType
string
The user selected order type.
POST
https://yourwebsite.com/wp-json/norsani/v1/verifycheckout
This call must be done just before user has been charged for the order. This will return a data array ready to be used with WooCommerce create order API endpoint. NOTE: This will create a WooCommerce on-hold order.
cartData
array
Cart data as send in Add to cart request.
ordertimings
array
Order preparation time array. i.e array( array( 'vendor_id' => 23, 'time' => 13:22, 'date' => 26 May, ), ... )
coupons
array
Array of coupon codes used.
billingForm
array
Billing form data. i.e array('billing_email' => user@example.com, ...)
paymentMethod
string
This must be the payment method slug used on WooCommerce. i.e for cash on delivery, WooCommerce uses "COD" slug.
customerNote
string
Delivery notes.
userLocation
string
User full address.
userLocationGeo
string
User geo-location address lat,lng
You must use to ensure REST API credentials cannot be intercepted by an attacker. Typically you will use any standard OAuth 1.0a library in the language of your choice to handle the authentication. For React Native users you can simply use the client that will handle the autentication for you.