The NewStore Connector enables you to seamlessly integrate within Mule apps. Manage integration events, master data, orders, catalogs, inventories, fulfillment.
This connector connects you to the NewStore REST API with a variety of operations to access the backend systems.
For compatibility information and fixed issues, see the release notes.
Release Notes: NewStore Release Notes
Connector Reference: NewStore Connector Reference
Before You Begin
To use this connector, you must be familiar with:
-
The NewStore REST API
-
Anypoint Connectors
-
Mule runtime engine (Mule)
-
Elements and global elements in a Mule flow
-
Creating a Mule app using Anypoint Studio
Before creating an app, you must have:
-
Access to a NewStore account.
Authentication Types
NewStore Connector connections use the following authentication type:
-
Basic authentication
Uses a username and password for authentication
Common Use Cases for the Connector
-
Integrate events with third-party systems or amazon S3 buckets, and the streamed events.
-
Route events to the correct business flows based on their type.
-
Inject and retrieve orders to/from NewStore, manage returns and fulfillment requests.
-
Manage transfers, receive, count and adjust stock of your products in your stores.
-
Request ATP(Available To Promise) globally or from fulfillment location groups, also manage your fulfillment location groups.
-
Manage stores, catalogs, stock and prices of your products.
-
Retrieve customer order history.
Using the connector
Add the connector to the Anypoint Studio
The Apache Maven pom.xml
file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your pom.xml file to enable access to this connector:
<dependency>
<groupId>io.positiveminds.mule.newstore</groupId>
<artifactId>newstore-connector</artifactId>
<version>1.1.0</version>
<classifier>mule-plugin</classifier>
</dependency>
To obtain the most up-to-date pom.xml file information:
-
You can check the latest version in the release notes
or
-
Go to Anypoint Exchange
-
In Exchange, click Login and supply your Anypoint Platform username and password.
-
In Exchange, search for NewStore.
-
Select the connector.
-
Click Dependency Snippets near the upper right of the screen.
Configure the Connector credentials with API Client
Field | Description |
---|---|
Tenant |
Typically the name of your company |
Stage |
The stage variable, for example: |
Client Id |
Your NewStore Client Id |
Client Secret |
Your NewStore Client Secret |
Scopes |
List of scopes that apply to the OAuth token |
<newstore:config name="NewStore_Config" doc:name="NewStore Config" doc:id="3486d881-9d07-40be-97f7-05746164f7d6">
<newstore:api-client-connection tenant="YOUR-INSTANCE-TENANT" stage="YOUR-INSTANCE-STAGE" clientId="YOUR-CLIENT-ID" clientSecret="YOUR-CLIENT-SECRET" scopes="customer:profile:read customer:profile:write" />
</newstore:config>
Studio - Retrieve the store pickup config
This use case provides an example of how to use the NewStore Connector to retrieve a store pickup configuration, it contains:
-
An HTTP Listener as the input source.
-
Uses a NewStore operation with a parameter.
-
Add a private flow with a HTTP Listener.
-
Search for
Get instore pickup config for store
in the Mule Palette. -
Drag the operation into your flow.
-
Insert the store id of your store, or insert it from the http query parameters like
attributes.queryParams.store
.
-
Drag a transform dataweave after the operation and add the following snippet:
%dw 2.0
output application/json
---
{
tax_code: payload.cost.tax_code,
currency_code: payload.cost.currency_code,
delivery_time: payload.delivery_time
}
XML - Retrieve the store pickup config
Paste the XML code provided in this example into the Configuration XML tab in Anypoint Studio to experiment with the flow described in the previous section.
Keep in mind that you must still provide the credentials for the NewStore connector.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:newstore="http://www.mulesoft.org/schema/mule/newstore"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/newstore http://www.mulesoft.org/schema/mule/newstore/current/mule-newstore.xsd">
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="d9d3b6a7-d997-466c-9110-86e491644c40" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<newstore:config name="NewStore_Config" doc:name="NewStore Config" doc:id="0793d58f-5aa0-4898-848b-a655cfc7d129">
<newstore:api-client-connection tenant="YOUR-INSTANCE-TENANT" stage="YOUR-INSTANCE-STAGE" clientId="YOUR-CLIENT-ID" clientSecret="YOUR-CLIENT-SECRET" scopes="customer:profile:read customer:profile:write" />
</newstore:config>
<flow name="retrieve-instore-pickup-config" doc:id="ab7cf23c-879b-4a04-b728-12b604e694dc" >
<http:listener doc:name="Listener" doc:id="0efe79ee-bd98-4b45-80f9-c1b4f4ee09a3" config-ref="HTTP_Listener_config" path="/test" />
<newstore:get-instore-pickup-config-for-store doc:id="e92f99e2-937f-4a99-a273-9c81d9638ceb" config-ref="NewStore_Config" storeId="#[attributes.queryParams.store]" doc:name="Get instore pickup config for store" />
<ee:transform doc:name="Transform Message" doc:id="736ce406-6dd1-4509-92f4-703bb3873663" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
{
tax_code: payload.cost.tax_code,
currency_code: payload.cost.currency_code,
delivery_time: payload.delivery_time
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
</mule>