Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Parameter Name

Required

Value

RequestName

Yes

GenerateSessionToken

LoginEmail

Yes

The email address of the NorthScope User for whom the token is being generated.

Password

Yes

The password to authenticate that user.

GenerateSessionToken: JSON Example

Code Block
languagejson
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com

{
  "NSRequest": {
    "RequestName": "GenerateSessionToken",
    "RequestContent": {
      "LoginEmail": "TestAPIUser@NorthScope.example.com",
      "Password": "StrongPassword"
    }
  }
}

GenerateSessionToken: XML Example

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com

<NSRequest>
  <RequestName>GenerateSessionToken</RequestName>
  <RequestContent>
    <LoginEmail>TestAPIUser@NorthScope.example.com</LoginEmail>
    <Password>StrongPassword</Password>
  </RequestContent>
</NSRequest>

If the request was valid, a response will be sent as follows:

GenerateSessionToken Response: JSON Example

Code Block
languagejson
{
  "NSResponse": {
    "Timestamp": "2018-09-20T15:21:23.425",
    "Success": "true",
    "ResponseContent": {
      "SessionToken": "00000000-0000-0000-0000-000000000000"
    }
  }
}

GenerateSessionToken Response: XML Example

Code Block
languagexml
<NSResponse>
  <Timestamp>2018-09-20T15:21:23.425</Timestamp>
  <Success>true</Success>
  <ResponseContent>
    <SessionToken>00000000-0000-0000-0000-000000000000</SessionToken>
  </ResponseContent>
</NSResponse>

If an invalid authentication request is made, the following result will be generated:

Example: Validation failure in JSON

Code Block
languagejson
{
  "NSResponse": {
    "Timestamp": "2018-09-20T14:57:51.830",
    "Success": "false",
    "Error": "The login information that was provided was invalid."
  }
}

Example: Validation failure in XML

Code Block
languagexml
<NSResponse>
  <Timestamp>2018-09-20T14:57:51.830</Timestamp>
  <Success>false</Success>
  <Error>The login information that was provided was invalid.</Error>
</NSResponse>

...

In the event the incorrect information is supplied, either when generating a new session token or when using a previously fetched token, you will receive an error from the web service of the following structure:

Example: Validation failure in JSON

Code Block
{
  "NSResponse": {
    "Timestamp": "2018-09-20T14:57:51.830",
    "Success": "false",
    "Error": "The login information that was provided was invalid."
  }
}

Example: Validation failure in XML

Code Block
languagexml
<NSResponse>
  <Timestamp>2018-09-20T14:57:51.830</Timestamp>
  <Success>false</Success>
  <Error>The login information that was provided was invalid.</Error>
</NSResponse>

...

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
	<RequestName>ListCompanies</RequestName>
</NSRequest>

Available Requests

The NorthScope Web Services API exposes the following requests to perform automated functionality within the NorthScope system.

ListCompanies

This request will provide a list of NorthScope companies your user has access to along with the numeric identifier, DataEntityCompanySK, which may be required by other API requests. This information is not likely to change so it usually would only need to be called once (to fetch and store known companies).

Accepted Information

This request accepts no parameters, the RequestContent node could be omitted entirely (or left empty).

Example Requests

...

languagejson

...

Testing the Web Service API via Postman

Postman is a free tool for developers and can be used to test web service requests. You can find it at: https://www.getpostman.com/.

With this tool, it’s easy to test web service requests. Follow these instructions to test your first command.

How to test your first command

Part 1. Obtain a token

Note: This is only necessary if you are using a user that is not setup to use a static token.

Referencing the two screenshots below, set the following information

0. Download and install Postman.

1. Set the URL of the web service request. This is usually the NorthScope URL + '/services/ActionCommand.svc/APIExecute

...

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
  <RequestName>ListCompanies</RequestName>
</NSRequest>

Example Responses

Code Block
languagejson
{
  "NSResponse": {
    "Timestamp": "2018-09-20T15:58:07.367",
    "Success": "true",
    "Companies": {
      "Company": [
        {
          "DataEntityCompanySK": "1",
          "CompanyID": "WESTTEST",
          "CompanyName": "West Coast Testing Company"
        },
        {
          "DataEntityCompanySK": "2",
          "CompanyID": "EASTTEST",
          "CompanyName": "East Coast Testing Company"
        }
      ]
    }
  }
}
}

Code Block

languagexml
<NSResponse> <Timestamp>2018-09-20T15:58:07.367</Timestamp> <Success>true</Success> <Companies> <Company> <DataEntityCompanySK>1</DataEntityCompanySK> <CompanyID>WESTTEST</CompanyID> <CompanyName>West Coast Testing Company</CompanyName> </Company> <Company> <DataEntityCompanySK>2</DataEntityCompanySK> <CompanyID>EASTTEST</CompanyID> <CompanyName>East Coast Testing Company</CompanyName> </Company> </Companies> </'.

2. Set the request type to POST

3. Set the message format to Text

4. Enter the login request XML into the bottom left pane.

...

5. Verify in the headers tab that no other other headers have been set, other than those shown in the screenshot below

...

6. Click the send button to issue the request. The pane in the bottom right should show <Success>true</Success> and have a valid session token you can use for step 2.

Part 2. Send a request for data

1. Modify the bottom left pane to use the ListCompanies request XML.

...

2. In the headers tab, add a header for NSLogin. Set this to equal the email address used in part 1

3. Add another header for NSAPISession. Set this to equal the token retrieved from part 1.

...

Click the send button to issue the ListCompanies request. If the system is working properly, you will see a response in the lower right pane with a list of companies from the instance of NorthScope.

Now you’re able to test any of the web service requests listed below.

Available Requests

The NorthScope Web Services API exposes the following requests to perform automated functionality within the NorthScope system.

ListCompanies

This request will provide a list of NorthScope companies your user has access to along with the numeric identifier, DataEntityCompanySK, which may be required by other API requests. This information is not likely to change so it usually would only need to be called once (to fetch and store known companies).

Accepted Information

This request accepts no parameters, the RequestContent node could be omitted entirely (or left empty).

Example Requests

Code Block
languagejson
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com 
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

{
  "NSRequest": {
    "RequestName": "ListCompanies"
  }
}

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
  <RequestName>ListCompanies</RequestName>
</NSRequest>

Example Responses

Code Block
languagejson
{
  "NSResponse": {
    "Timestamp": "2018-09-20T15:58:07.367",
    "Success": "true",
    "Companies": {
      "Company": [
        {
          "DataEntityCompanySK": "1",
          "CompanyID": "WESTTEST",
          "CompanyName": "West Coast Testing Company"
        },
        {
          "DataEntityCompanySK": "2",
          "CompanyID": "EASTTEST",
          "CompanyName": "East Coast Testing Company"
        }
      ]
    }
  }
}
}

Code Block
languagexml
<NSResponse>
  <Timestamp>2018-09-20T15:58:07.367</Timestamp>
  <Success>true</Success>
  <Companies>
    <Company>
      <DataEntityCompanySK>1</DataEntityCompanySK>
      <CompanyID>WESTTEST</CompanyID>
      <CompanyName>West Coast Testing Company</CompanyName>
    </Company>
    <Company>
      <DataEntityCompanySK>2</DataEntityCompanySK>
      <CompanyID>EASTTEST</CompanyID>
      <CompanyName>East Coast Testing Company</CompanyName>
    </Company>
  </Companies>
</NSResponse>

ListSalesOrders

...

Parameter Name

Required

Comment

OrderItemSK

Yes

The identifier for the Sales Order Line Item being allocated.

LotSK

Yes

The identifier for the Inventory Lot from which the inventory will be drawn.

AllocateUnits

No

The number of Units (in the supplied Unit of Measure) to allocate. Not required if the item is managed by Weight only.

UnitsUOM

No

The Unit of Measure ID for the units in which the inventory is being allocated.

AllocateWeight

No

The amount of Weight (in the supplied Unit of Measure) to allocate. Not required if the item is managed by Units only.

WeightUOM

No

The Unit of Measure ID for the weight in which the inventory is being allocated.

...

Example Requests

Code Block
languagejson
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

{
  "NSRequest": {
    "RequestName": "AllocateSalesOrders",
    "RequestContent": {
      "Allocation": [
        {
          "OrderItemSK": "100",
          "LotSK": "1",
          "AllocateUnits": "5",
          "UnitsUOM": "Case",
          "AllocateWeight": "113.4",
          "WeightUOM": "kg"
        },
        {
          "OrderItemSK": "101",
          "LotSK": "1",
          "AllocateUnits": "5",
          "UnitsUOM": "Case",
          "AllocateWeight": "113.4",
          "WeightUOM": "kg"
        }
      ]
    }
  }
}

XML Example

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
  <RequestName>AllocateSalesOrders</RequestName>
  <RequestContent>
    <Allocation>
      <OrderItemSK>100</OrderItemSK>
      <LotSK>1</LotSK>
      <AllocateUnits>5</AllocateUnits>
      <UnitsUOM>Case</UnitsUOM>
      <AllocateWeight>113.4</AllocateWeight>
      <WeightUOM>kg</WeightUOM>
    </Allocation>
    <Allocation>
      <OrderItemSK>101</OrderItemSK>
      <LotSK>1</LotSK>
      <AllocateUnits>5</AllocateUnits>
      <UnitsUOM>Case</UnitsUOM>
      <AllocateWeight>113.4</AllocateWeight>
      <WeightUOM>kg</WeightUOM>
    </Allocation>
  </RequestContent>
</NSRequest>

Example Response

This request has no specific response, instead you would receive a generic success or failure with a timestamp and error (assuming the request failed).

InsertInboundIntegration

Add here

ListUOMSchedules

This request will accept a list of allocations to perform, verify they are valid and then allocate the inventory from a given LotSK to a given OrderItemSK. Both LotSK and OrderItemSK can be retrieved from the ListInventoryLots and ListSalesOrders requests, respectively.

Accepted Information

...

Parameter Name

...

Required

...

Comment

...

OrderItemSK

...

Yes

...

The identifier for the Sales Order Line Item being allocated.

...

LotSK

...

Yes

...

The identifier for the Inventory Lot from which the inventory will be drawn.

...

AllocateUnits

...

No

...

The number of Units (in the supplied Unit of Measure) to allocate. Not required if the item is managed by Weight only.

...

UnitsUOM

...

No

...

The Unit of Measure ID for the units in which the inventory is being allocated.

...

AllocateWeight

...

No

...

The amount of Weight (in the supplied Unit of Measure) to allocate. Not required if the item is managed by Units only.

...

WeightUOM

...

No

...

The Unit of Measure ID for the weight in which the inventory is being allocated.

ListSites

This request will generate a list of sites. Except for the DataEntityCompanySK, all criteria are not required. The Sites returned must match any of the provided criteria of a type. Any empty element can be included to indicate filtering on a value being not set.

Accepted Information

...

Parameter Name

...

Required

...

Comment

...

DataEntityCompanySK

...

Yes

...

The identifier for the company from which to pull sites.

...

WhereClause

...

No

...

Filtering parameter for returned data.

 

The WhereClause parameter enables only a selection of data to be sent back in the reply, based on filter criteria written with SQL syntax. Any of the site properties can be referenced.

 

Where Clause Columns

...

Column Name

...

SiteSK

...

SiteID

...

SiteName

...

CompanyID

...

DataEntityCompanySK

...

AddressLine1

...

AddressLine2

...

City

...

State

...

Zip

...

Country

...

Phone1

...

Fax

 

 

Example Request

Code Block
languagexml
<NSRequest>
	<RequestName>ListSites</RequestName>
	<RequestContent>
		<DataEntityCompanySK>1</DataEntityCompanySK>
		<WhereClause>State = 'WA' OR SiteName LIKE '%a%'</WhereClause>
	</RequestContent>
</NSRequest>

Note: JSON is not supported for this command.

Example Response

Code Block
languagexml
<NSResponse>
	<Timestamp>2019-12-02T10:00:10.405</Timestamp>
	<Success>true</Success>
	<SiteList>
		<Site>
			<SiteSK>1</SiteSK>
			<SiteID>ABC</SiteID>
			<SiteName>Site Name 1</SiteName>
			<CompanyID>Company ID 1</CompanyID>
			<DataEntityCompanySK>1</DataEntityCompanySK>
			<AddressLine1>1234 NE Street</AddressLine1>
			<AddressLine2 />
			<City>Seattle</City>
			<State>WA</State>
			<Zip>99999</Zip>
			<Country>USA</Country>
			<Phone1>123-456-7890</Phone1>
			<Fax>123-456-7891</Fax>
		</Site>
		<Site>
			<SiteSK>2</SiteSK>
			<SiteID>ABD</SiteID>
			<SiteName>Site Name 2</SiteName>
			<CompanyID>Company ID 1</CompanyID>
			<DataEntityCompanySK>1</DataEntityCompanySK>
			<AddressLine1>1234 SE Street</AddressLine1>
			<AddressLine2 />
			<City>Houston</City>
			<State>TX</State>
			<Zip>99999</Zip>
			<Country>USA</Country>
			<Phone1>123-000-7890</Phone1>
			<Fax>123-000-7891</Fax>
		</Site>
	</SiteList>
</NSResponse>

ListSalesOrders

ListItems

 

ListCustomerAddresses

This request will accept a list of allocations to perform

 

 provides a way to leverage NorthScope’s existing mechanism for 3rd party integrations. Using the InsertInboundIntegration web request, data can be inserted into a NorthScope instance’s inbound queue.

Everything in the <Data> </Data> section is what will be placed into the inbound queue. For more information on the inbound queue and what to send there, see IM Adjustment (XML) as an example. The code below sends a fake transaction ‘TransactionABC’ of type ‘IMTransferXYZ’. To send a different kind of transaction to the inbound queue, simply replace the XML inside the <Data> </Data> section.

Example Request

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
    <RequestName>InsertInboundIntegration</RequestName>
    <RequestContent>
        <InboundIntegration>
            <Created>2019-12-2</Created>
            <SourceSystem>NS Test</SourceSystem>
            <SourceTransactionID>TransactionABC</SourceTransactionID>
            <TransactionType>IMTransferXYZ</TransactionType>
            <Data>
                <TransactionHeader>
                    <TransactionType>Adjustment</TransactionType>
                    <TransactionClassID>Default</TransactionClassID>
                    <TransactionID>A123456</TransactionID>
                    <TransactionStatusName>Ready To Post</TransactionStatusName>
                    <SiteID>ABC</SiteID>
                    <TransactionDate>2017-12-19</TransactionDate>
                    <ReasonCode />
                    <UserID>Integrated</UserID>
                    <CompanyID>XYZ</CompanyID>
                    <TransactionDetail>
                        <ItemSort />
                        <ItemID>1234321</ItemID>
                        <TransactionUnits>5.00000</TransactionUnits>
                        <UnitsUOMID>CASE</UnitsUOMID>
                        <TransactionWeight>150.5500</TransactionWeight>
                        <WeightUOMID>LB</WeightUOMID>
                        <Lot>18001</Lot>
                        <Owner>NLP</Owner>
                    </TransactionDetail>
                </TransactionHeader>
            </Data>
        </InboundIntegration>
    </RequestContent>
</NSRequest>

Example Response

Code Block
languagexml
<NSResponse>
  <Timestamp>2019-12-02T14:15:11.539</Timestamp>
  <Success>true</Success>
</NSResponse>

ListUOMSchedules

This request will retrieve a list of UOM schedules.

Accepted Information

Parameter Name

Required

Comment

DataEntityCompanySK

Yes

The identifier for the company from which to pull sites.

WhereClause

No

Filtering parameter for returned data.

The WhereClause parameter enables only a selection of data to be sent back in the reply, based on filter criteria written with SQL syntax. Any of the UOM schedule properties can be referenced.

Example Request

Code Block
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
  <RequestName>NorthPacificUOMScheduleMaster</RequestName>
  <RequestContent>
    <DataEntityCompanySK>1</DataEntityCompanySK>
  </RequestContent>
</NSRequest>

Example Response

Code Block
languagexml
<NSResponse>
  <Timestamp>2019-12-02T14:15:10.148</Timestamp>
  <Success>true</Success>
  <ScheduleList>
    <Schedule>
      <ScheduleSK>1</ScheduleSK>
      <FromUOMID>Each</FromUOMID>
      <ToUOMID>Each</ToUOMID>
      <ConversionValue>1.00000</ConversionValue>
    </Schedule>
    <Schedule>
      <ScheduleSK>2</ScheduleSK>
      <FromUOMID>Each</FromUOMID>
      <ToUOMID>Bag</ToUOMID>
      <ConversionValue>1.00000</ConversionValue>
    </Schedule>
    <Schedule>
      <ScheduleSK>3</ScheduleSK>
      <FromUOMID>Bag</FromUOMID>
      <ToUOMID>kg</ToUOMID>
      <ConversionValue>18.14369</ConversionValue>
    </Schedule>
  </ScheduleList>
</NSResponse>

ListSites

This request will retrieve a list of sites.

Accepted Information

Parameter Name

Required

Comment

DataEntityCompanySK

Yes

The identifier for the company from which to pull sites.

WhereClause

No

Filtering parameter for returned data.

The WhereClause parameter enables only a selection of data to be sent back in the reply, based on filter criteria written with SQL syntax. Any of the site properties can be referenced.

Example Request

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
	<RequestName>ListSites</RequestName>
	<RequestContent>
		<DataEntityCompanySK>1</DataEntityCompanySK>
		<WhereClause>State = 'WA' OR SiteName LIKE '%a%'</WhereClause>
	</RequestContent>
</NSRequest>

Note: JSON is not supported for this command.

Example Response

Code Block
languagexml
<NSResponse>
	<Timestamp>2019-12-02T10:00:10.405</Timestamp>
	<Success>true</Success>
	<SiteList>
		<Site>
			<SiteSK>1</SiteSK>
			<SiteID>ABC</SiteID>
			<SiteName>Site Name 1</SiteName>
			<CompanyID>Company ID 1</CompanyID>
			<DataEntityCompanySK>1</DataEntityCompanySK>
			<AddressLine1>1234 NE Street</AddressLine1>
			<AddressLine2 />
			<City>Seattle</City>
			<State>WA</State>
			<Zip>99999</Zip>
			<Country>USA</Country>
			<Phone1>123-456-7890</Phone1>
			<Fax>123-456-7891</Fax>
		</Site>
		<Site>
			<SiteSK>2</SiteSK>
			<SiteID>ABD</SiteID>
			<SiteName>Site Name 2</SiteName>
			<CompanyID>Company ID 1</CompanyID>
			<DataEntityCompanySK>1</DataEntityCompanySK>
			<AddressLine1>1234 SE Street</AddressLine1>
			<AddressLine2 />
			<City>Houston</City>
			<State>TX</State>
			<Zip>99999</Zip>
			<Country>USA</Country>
			<Phone1>123-000-7890</Phone1>
			<Fax>123-000-7891</Fax>
		</Site>
	</SiteList>
</NSResponse>

ListSalesOrders

This request will retrieve a list of sales orders and sales order details.

Accepted Information

Parameter Name

Required

Comment

DataEntityCompanySK

Yes

The identifier for the company from which to pull sites.

WhereClause

No

Filtering parameter for returned data.

The WhereClause parameter enables only a selection of data to be sent back in the reply, based on filter criteria written with SQL syntax. Any of the sales order (not detail) properties can be referenced.

Example Request

Code Block
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
  <RequestName>NorthPacificSalesOrder</RequestName>
  <RequestContent>
    <DataEntityCompanySK>1</DataEntityCompanySK>
    <WhereClause>SiteID = '400'</WhereClause>
  </RequestContent>
</NSRequest>

Note: JSON is not supported for this request.

Example Response

Code Block
languagexml
<NSResponse>
    <Timestamp>2019-12-02T14:15:06.265</Timestamp>
    <Success>true</Success>
    <SalesOrders>
        <SalesOrder>
            <CompanyID>Acme</CompanyID>
            <SiteID>123</SiteID>
            <OrderID>PO500</OrderID>
            <CustomerID>BrownCo</CustomerID>
            <CustomerSK>889</CustomerSK>
            <AddressID>BrownCoPPT1</AddressID>
            <ScheduledShipDate>2019-11-20T00:00:00</ScheduledShipDate>
            <ScheduledDeliveryDate>2019-11-29T00:00:00</ScheduledDeliveryDate>
            <CarrierName>Good Old Shipping Company</CarrierName>
            <OrderDate>2019-11-13T00:00:00</OrderDate>
            <ShipAddressSK>7878</ShipAddressSK>
            <OrderHeaderSK>9090</OrderHeaderSK>
            <OrderStatusSK>2</OrderStatusSK>
            <OrderTypeSK>2</OrderTypeSK>
            <OrderDetails>
                <OrderDetail>
                    <OrderItemSK>400</OrderItemSK>
                    <OrderHeaderSK>9090</OrderHeaderSK>
                    <ItemID>8998</ItemID>
                    <ManageItemsByEN>3</ManageItemsByEN>
                    <WeightUOMID>Lbs</WeightUOMID>
                    <UnitUOMID>Each</UnitUOMID>
                    <ItemDescription>Pudding 6-10 Lbs. Fresh</ItemDescription>
                    <OrderedUnits>22</OrderedUnits>
                    <OrderedWeight>220</OrderedWeight>
                    <ItemSort>2</ItemSort>
                </OrderDetail>
                <OrderDetail>
                    <OrderItemSK>900</OrderItemSK>
                    <OrderHeaderSK>9090</OrderHeaderSK>
                    <ItemID>2359</ItemID>
                    <ManageItemsByEN>3</ManageItemsByEN>
                    <WeightUOMID>Lbs</WeightUOMID>
                    <UnitUOMID>Case</UnitUOMID>
                    <ItemDescription>Flakes Cereal #2</ItemDescription>
                    <OrderedUnits>15.00000</OrderedUnits>
                    <OrderedWeight>150.00000</OrderedWeight>
                    <ItemSort>1</ItemSort>
                </OrderDetail>
            </OrderDetails>
        </SalesOrder>
    </SalesOrders>
</NSResponse>

ListItems

This request will retrieve a list of items.

Accepted Information

Parameter Name

Required

Comment

DataEntityCompanySK

Yes

The identifier for the company from which to pull sites.

WhereClause

No

Filtering parameter for returned data.

The WhereClause parameter enables only a selection of data to be sent back in the reply, based on filter criteria written with SQL syntax. Any of the Item properties can be referenced.

Example Request

Code Block
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
  <RequestName>NorthPacificItemMaster</RequestName>
  <RequestContent>
    <DataEntityCompanySK>1</DataEntityCompanySK>
  </RequestContent>
</NSRequest>  

Note: JSON is not supported for this command.

Example Response

Code Block
languagexml
<NSResponse>
    <Timestamp>2019-12-02T14:15:04.574</Timestamp>
    <Success>true</Success>
    <ItemList>
        <Item>
            <ItemID>4010</ItemID>
            <ItemSK>1</ItemSK>
            <ItemDescription>A do-dad</ItemDescription>
            <CompanyID>Acme</CompanyID>
            <TrackMethodEN>3</TrackMethodEN>
            <ManageItemsByEN>3</ManageItemsByEN>
            <IsItemVariableWeight>1</IsItemVariableWeight>
            <ClassID>Wholesale</ClassID>
            <UnitsUOMID>Each</UnitsUOMID>
            <WeightUOMID>Lbs</WeightUOMID>
            <BaseUOMID>Lbs</BaseUOMID>
            <ExpirationDays>999</ExpirationDays>
            <ScheduleSK>58</ScheduleSK>
            <ShippingWeight>1</ShippingWeight>
        </Item>
        <Item>
            <ItemID>5050</ItemID>
            <ItemSK>2</ItemSK>
            <ItemDescription>A thingamajig</ItemDescription>
            <CompanyID>Acme</CompanyID>
            <TrackMethodEN>3</TrackMethodEN>
            <ManageItemsByEN>3</ManageItemsByEN>
            <IsItemVariableWeight>1</IsItemVariableWeight>
            <ClassID>Wholesale</ClassID>
            <UnitsUOMID>Each</UnitsUOMID>
            <WeightUOMID>Lbs</WeightUOMID>
            <BaseUOMID>Lbs</BaseUOMID>
            <ExpirationDays>999</ExpirationDays>
            <ScheduleSK>57</ScheduleSK>
            <ShippingWeight>0</ShippingWeight>
        </Item>
    </ItemList>
</NSResponse>

ListCustomerAddresses

This request will retrieve a list of customer addresses.

Accepted Information

Parameter Name

Required

Comment

DataEntityCompanySK

Yes

The identifier for the company from which to pull sites.

WhereClause

No

Filtering parameter for returned data.

The WhereClause parameter enables only a selection of data to be sent back in the reply, based on filter criteria written with SQL syntax. Any of the customer address properties can be referenced.

Example Request

Code Block
languagexml
POST /services/ActionCommand.svc/APIExecute HTTP/1.1
Host: NorthScope.example.com
NSLogin: TestAPIUser@NorthScope.example.com
NSAPISession: 00000000-0000-0000-0000-000000000000

<NSRequest>
  <RequestName>NorthPacificCustomer</RequestName>
  <RequestContent>
    <DataEntityCompanySK>1</DataEntityCompanySK>
  </RequestContent>
</NSRequest>

Note: JSON is not supported for this web request.

Example Response

Code Block
languagexml
<NSResponse>
    <Timestamp>2019-12-02T14:15:07.058</Timestamp>
    <Success>true</Success>
    <CustomerShipToList>
        <CustomerShipTo>
            <CustomerSK>8001</CustomerSK>
            <CustomerID>CustomerID1</CustomerID>
            <CustomerName>Acme Company</CustomerName>
            <AddressID>ACMEADDR1</AddressID>
            <AddressName>Acme Building A</AddressName>
            <AddressLine1>1234 SE StreetName BLD A</AddressLine1>
            <AddressLine2 />
            <City>Seattle</City>
            <State>WA</State>
            <Zip>98125</Zip>
            <Country>USA</Country>
            <AddressTypeEN>3</AddressTypeEN>
            <CompanyID>CompanyID</CompanyID>
        </CustomerShipTo>
        <CustomerShipTo>
            <CustomerSK>8001</CustomerSK>
            <CustomerID>CustomerID1</CustomerID>
            <CustomerName>Acme Company</CustomerName>
            <AddressID>ACMEADDR2</AddressID>
            <AddressName>Acme Building B</AddressName>
            <AddressLine1>1234 SE StreetName BLD A</AddressLine1>
            <AddressLine2 />
            <City>Seattle</City>
            <State>WA</State>
            <Zip>98125</Zip>
            <Country>USA</Country>
            <AddressTypeEN>4</AddressTypeEN>
            <CompanyID>CompanyID</CompanyID>
        </CustomerShipTo>
    </CustomerShipToList>
</NSResponse>

Powershell Client Example

This document would not be complete without at least one example of how a client might access the web service. Below is an example client program that can obtain a token and request a list of companies from a NorthScope web service. Powershell may not be the best tool for your situation, but the client steps will remain the same, as implemented below.

To run this example, be sure to use the correct username and password, and the URL for your NorthScope server. Save as a ps1 file and run via the Windows Powershell application.

Code Block
languagepowershell
$user="sh@thenlp.com"
$password="admin"
$url="http://doug/test/services/ActionCommand.svc/APIExecute"

#Constructs XML for a login request of the NS web service handler
$loginReq = "<NSRequest>
                <RequestName>GenerateSessionToken</RequestName>
                <RequestContent>
                    <LoginEmail>"+$user+"</LoginEmail>
                    <Password>"+$password+"</Password>
                </RequestContent>
            </NSRequest>"

$webReq = "<NSRequest>
                <RequestName>ListCompanies</RequestName>
                <RequestContent>
                </RequestContent>
            </NSRequest>"

#region Login and obtain token
$Body = [byte[]][char[]]$loginReq #convert login request to byte array

#build web request login packet
$Request = [System.Net.WebRequest]::Create($url);
$Request.Method = 'POST';
$Request.Accept = "text/html"
$Request.AllowAutoRedirect = $false
$Request.ContentType = "applications/text"
$Request.ContentLength = $Body.length
$Request.TimeOut = 5000000
$Request.KeepAlive = $true
$Request.Headers.Add("Keep-Alive: 300");
$reqst = $Request.getRequestStream()
$reqst.write($Body, 0, $Body.length)
$reqst.flush()
$reqst.close()

#send request and wait for response
[net.httpWebResponse] $res = $Request.getResponse()
$resst = $res.getResponseStream()
$sr = new-object IO.StreamReader($resst)
$result = $sr.ReadToEnd()
$res.close()
$tokenReply = [xml]$result #parse response to xml
#endregion

#region Send web service request
#build the main web request content packet
$Body = [byte[]][char[]]$webReq #convert web request to byte array
$Request = [System.Net.WebRequest]::Create($url);
$Request.Method = 'POST';
$Request.Accept = "text/html"
$Request.AllowAutoRedirect = $false
$Request.ContentType = "applications/text"
$Request.ContentLength = $Body.length
$Request.TimeOut = 5000000
$Request.KeepAlive = $true

#Insert the login and token into the header
$h1 = "NSLogin:"+$user
$h2 = "NSAPISession:"+$tokenReply.NSResponse.ResponseContent.SessionToken
$Request.Headers.Add($h1)
$Request.Headers.Add($h2)

$reqst = $Request.getRequestStream()
$reqst.write($Body, 0, $Body.length)
$reqst.flush()
$reqst.close()

#send request and wait for response
[net.httpWebResponse] $res = $Request.getResponse()
$resst = $res.getResponseStream()
$sr = new-object IO.StreamReader($resst)
$result = $sr.ReadToEnd()
$res.close()
$rep = [xml]$result #parse response to xml
#endregion

$Error = $rep.NSResponse.Error
$ResponseXML = $rep.NSResponse.OuterXml

$Companies = $rep.NSResponse.Companies.Company
$Companies #print retrieved company list