ordercloud-ng-sdk
v1.0.27
Published
OrderCloud AngularJS 1.x SDK
Downloads
2
Maintainers
Keywords
Readme
OrderCloud SDK
An AngularJs SDK for OrderCloud API
Table of Contents
Getting Started
$ bower install ordercloud-angular-sdk --save-dev
Or just include the output in the dist folder directly in your project.
REQUIREMENTS
This sdk is to always be used in conjunction with another angular project. You must also define some variable constants in the referecing application.
angular.module('orderCloud', [])
.constant('clientid', '...')
.constant('authurl', '...')
.constant('apiurl', '...')
In some cases, your app will need to access multiple buyer companies, so the buyerid is not stored as a constant. Instead, the buyerid is stored in an AngularJS factory named BuyerID within this sdk. In order to set an initial/default buyerid, add a run function in addition to the above constants.
.run(function(BuyerID) { OrderCloud.BuyerID.Set('BUYERIDHERE'); })
The BuyerID function can be used within any AngularJS controller and/or factory within your application in order to change which buyerid should be used. Simply inject the BuyerID factory into your controller or factory and call OrderCloud.BuyerID.Set('NEWIDHERE');. If needed, OrderCloud.BuyerID().Get() will return the buyerid that is currently set.
The CatalogID function can be used within any AngularJS controller and/or factory within your application in order to change which catalogid should be used. Simply inject the CatalogID factory into your controller or factory and call OrderCloud.CatalogID.Set('NEWIDHERE');. If needed, OrderCloud.CatalogID().Get() will return the catalogid that is currently set.
API RESOURCES AND METHODS
SecurityProfiles
angular.module('orderCloud.sdk).factory(SecurityProfiles, SecurityProfilesFactory)
Get a Single Security Profile
OrderCloud.SecurityProfiles.Get(securityProfileID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |securityProfileID|string|ID of the security profile.|
Response Body Sample
{
"ID": "…",
"IsDevProfile": false,
"Name": "…",
"Roles": [
"…"
]
}
Get a List of Security Profiles
OrderCloud.SecurityProfiles.List(listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"IsDevProfile": false,
"Name": "…",
"Roles": [
"…"
]
}
]
}
List Assignments
OrderCloud.SecurityProfiles.ListAssignments(securityProfileID,userID,userGroupID,level,page,pageSize).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |securityProfileID|string|ID of the security profile.| |userID|string|ID of the user.| |userGroupID|string|ID of the user group.| |level|string|Level of the security profile.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"SecurityProfileID": "…",
"BuyerID": "…",
"UserID": "…",
"UserGroupID": "…"
}
]
}
Delete Assignment
OrderCloud.SecurityProfiles.DeleteAssignment(securityProfileID,userID,userGroupID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |securityProfileID|string|ID of the security profile.| |userID|string|ID of the user.| |userGroupID|string|ID of the user group.|
Save Assignment
OrderCloud.SecurityProfiles.SaveAssignment(assignment).then(successFn).catch(errorFn);
Request Body Sample
{
"SecurityProfileID": "…",
"BuyerID": "…",
"UserID": "…",
"UserGroupID": "…"
}
ForgottenPassword
angular.module('orderCloud.sdk).factory(ForgottenPassword, ForgottenPasswordFactory)
Send Verification Code
OrderCloud.ForgottenPassword.SendVerificationCode(passwordResetRequest).then(successFn).catch(errorFn);
Request Body Sample
{
"ClientID": "…",
"Email": "…",
"Username": "…",
"URL": "…"
}
Reset Password
OrderCloud.ForgottenPassword.ResetPassword(verificationCode,passwordReset).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |verificationCode|string|Verification code of the forgotten password.|
Request Body Sample
{
"ClientID": "…",
"Username": "…",
"Password": "…"
}
Me
angular.module('orderCloud.sdk).factory(Me, MeFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
Get the Current Authenticated User
OrderCloud.Me.Get().then(successFn).catch(errorFn);
Response Body Sample
{
"ID": "…",
"Username": "…",
"FirstName": "…",
"LastName": "…",
"Email": "…",
"Phone": "…",
"TermsAccepted": null,
"Active": false,
"xp": null,
"AvailableRoles": [
"…"
]
}
Update the Currently Authenticated User
OrderCloud.Me.Update(user).then(successFn).catch(errorFn);
Request Body Sample
{
"ID": "…",
"Username": "…",
"Password": "…",
"FirstName": "…",
"LastName": "…",
"Email": "…",
"Phone": "…",
"TermsAccepted": null,
"Active": false,
"xp": null
}
Patch the Currently Authenticated User.
OrderCloud.Me.Patch(user).then(successFn).catch(errorFn);
Request Body Sample
{
"ID": "…",
"Username": "…",
"Password": "…",
"FirstName": "…",
"LastName": "…",
"Email": "…",
"Phone": "…",
"TermsAccepted": null,
"Active": false,
"xp": null
}
Create From Temp User
OrderCloud.Me.CreateFromTempUser(user,tempUserToken).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |tempUserToken|string|Temp user token of the me.|
Request Body Sample
{
"ID": "…",
"Username": "…",
"Password": "…",
"FirstName": "…",
"LastName": "…",
"Email": "…",
"Phone": "…",
"TermsAccepted": null,
"Active": false,
"xp": null
}
CostCenters
angular.module('orderCloud.sdk).factory(CostCenters, CostCentersFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List Cost Centers
OrderCloud.CostCenters.ListCostCenters(listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Name": "…",
"Description": "…",
"xp": null
}
]
}
UserGroups
angular.module('orderCloud.sdk).factory(UserGroups, UserGroupsFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List User Groups
OrderCloud.UserGroups.ListUserGroups(listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Name": "…",
"Description": "…",
"xp": null
}
]
}
Addresses
angular.module('orderCloud.sdk).factory(Addresses, AddressesFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List Addresses
OrderCloud.Addresses.ListAddresses(listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Shipping": false,
"Billing": false,
"Editable": false,
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
}
]
}
Create Address
OrderCloud.Addresses.CreateAddress(address).then(successFn).catch(errorFn);
Request Body Sample
{
"Shipping": false,
"Billing": false,
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
}
Get Address
OrderCloud.Addresses.GetAddress(addressID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |addressID|string|ID of the address.|
Response Body Sample
{
"ID": "…",
"Shipping": false,
"Billing": false,
"Editable": false,
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
}
Update Address
OrderCloud.Addresses.UpdateAddress(addressID,address).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |addressID|string|ID of the address.|
Request Body Sample
{
"Shipping": false,
"Billing": false,
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
}
Patch Address
OrderCloud.Addresses.PatchAddress(addressID,address).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |addressID|string|ID of the address.|
Request Body Sample
{
"Shipping": false,
"Billing": false,
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
}
Delete Address
OrderCloud.Addresses.DeleteAddress(addressID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |addressID|string|ID of the address.|
CreditCards
angular.module('orderCloud.sdk).factory(CreditCards, CreditCardsFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
Create Credit Card
OrderCloud.CreditCards.CreateCreditCard(creditCard).then(successFn).catch(errorFn);
Request Body Sample
{
"Token": "…",
"CardType": "…",
"PartialAccountNumber": "…",
"CardholderName": "…",
"ExpirationDate": null,
"xp": null
}
List Credit Cards
OrderCloud.CreditCards.ListCreditCards(listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Editable": false,
"Token": "…",
"DateCreated": null,
"CardType": "…",
"PartialAccountNumber": "…",
"CardholderName": "…",
"ExpirationDate": null,
"xp": null
}
]
}
Get Credit Card
OrderCloud.CreditCards.GetCreditCard(creditcardID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |creditcardID|string|ID of the creditcard.|
Response Body Sample
{
"ID": "…",
"Editable": false,
"Token": "…",
"DateCreated": null,
"CardType": "…",
"PartialAccountNumber": "…",
"CardholderName": "…",
"ExpirationDate": null,
"xp": null
}
Update Credit Card
OrderCloud.CreditCards.UpdateCreditCard(creditcardID,creditCard).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |creditcardID|string|ID of the creditcard.|
Request Body Sample
{
"Token": "…",
"CardType": "…",
"PartialAccountNumber": "…",
"CardholderName": "…",
"ExpirationDate": null,
"xp": null
}
Patch Credit Card
OrderCloud.CreditCards.PatchCreditCard(creditcardID,creditCard).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |creditcardID|string|ID of the creditcard.|
Request Body Sample
{
"Token": "…",
"CardType": "…",
"PartialAccountNumber": "…",
"CardholderName": "…",
"ExpirationDate": null,
"xp": null
}
Delete Credit Card
OrderCloud.CreditCards.DeleteCreditCard(creditcardID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |creditcardID|string|ID of the creditcard.|
Categories
angular.module('orderCloud.sdk).factory(Categories, CategoriesFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List Categories
OrderCloud.Categories.ListCategories(listArgs,depth,catalogID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |depth|string|Depth of the category.| |catalogID|string|ID of the catalog.| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Name": "…",
"Description": "…",
"xp": null,
"ListOrder": 1,
"Active": false,
"ParentID": "…",
"ChildCount": 0
}
]
}
Products
angular.module('orderCloud.sdk).factory(Products, ProductsFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List Products
OrderCloud.Products.ListProducts(listArgs,categoryID,catalogID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |categoryID|string|ID of the category.| |catalogID|string|ID of the catalog.| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ReplenishmentPriceSchedule": {
"ID": "…",
"Name": "…",
"ApplyTax": false,
"ApplyShipping": false,
"MinQuantity": null,
"MaxQuantity": null,
"UseCumulativeQuantity": false,
"RestrictedQuantity": false,
"OrderType": "Standard",
"PriceBreaks": [
{
"Quantity": 0,
"Price": 0.0
}
],
"xp": null
},
"StandardPriceSchedule": {
"ID": "…",
"Name": "…",
"ApplyTax": false,
"ApplyShipping": false,
"MinQuantity": null,
"MaxQuantity": null,
"UseCumulativeQuantity": false,
"RestrictedQuantity": false,
"OrderType": "Standard",
"PriceBreaks": [
{
"Quantity": 0,
"Price": 0.0
}
],
"xp": null
},
"ID": "…",
"Name": "…",
"Description": "…",
"QuantityMultiplier": 0,
"ShipWeight": null,
"ShipHeight": null,
"ShipWidth": null,
"ShipLength": null,
"Active": false,
"Type": "Static",
"InventoryEnabled": false,
"InventoryNotificationPoint": null,
"VariantLevelInventory": false,
"SpecCount": 0,
"xp": null,
"AllowOrderExceedInventory": false,
"InventoryVisible": false,
"VariantCount": 0,
"ShipFromAddressID": "…"
}
]
}
Get Product
OrderCloud.Products.GetProduct(productID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |productID|string|ID of the product.|
Response Body Sample
{
"ReplenishmentPriceSchedule": {
"ID": "…",
"Name": "…",
"ApplyTax": false,
"ApplyShipping": false,
"MinQuantity": null,
"MaxQuantity": null,
"UseCumulativeQuantity": false,
"RestrictedQuantity": false,
"OrderType": "Standard",
"PriceBreaks": [
{
"Quantity": 0,
"Price": 0.0
}
],
"xp": null
},
"StandardPriceSchedule": {
"ID": "…",
"Name": "…",
"ApplyTax": false,
"ApplyShipping": false,
"MinQuantity": null,
"MaxQuantity": null,
"UseCumulativeQuantity": false,
"RestrictedQuantity": false,
"OrderType": "Standard",
"PriceBreaks": [
{
"Quantity": 0,
"Price": 0.0
}
],
"xp": null
},
"ID": "…",
"Name": "…",
"Description": "…",
"QuantityMultiplier": 0,
"ShipWeight": null,
"ShipHeight": null,
"ShipWidth": null,
"ShipLength": null,
"Active": false,
"Type": "Static",
"InventoryEnabled": false,
"InventoryNotificationPoint": null,
"VariantLevelInventory": false,
"SpecCount": 0,
"xp": null,
"AllowOrderExceedInventory": false,
"InventoryVisible": false,
"VariantCount": 0,
"ShipFromAddressID": "…"
}
List Specs
OrderCloud.Products.ListSpecs(productID,listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |productID|string|ID of the product.| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"Options": [
{
"ID": "…",
"Value": "…",
"ListOrder": 0,
"IsOpenText": false,
"PriceMarkupType": null,
"PriceMarkup": null,
"xp": null
}
],
"ID": "…",
"ListOrder": 0,
"Name": "…",
"DefaultValue": "…",
"Required": false,
"AllowOpenText": false,
"DefaultOptionID": "…",
"DefinesVariant": false,
"xp": null
}
]
}
Get Spec
OrderCloud.Products.GetSpec(productID,specID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |productID|string|ID of the product.| |specID|string|ID of the spec.|
Response Body Sample
{
"Options": [
{
"ID": "…",
"Value": "…",
"ListOrder": 0,
"IsOpenText": false,
"PriceMarkupType": null,
"PriceMarkup": null,
"xp": null
}
],
"ID": "…",
"ListOrder": 0,
"Name": "…",
"DefaultValue": "…",
"Required": false,
"AllowOpenText": false,
"DefaultOptionID": "…",
"DefinesVariant": false,
"xp": null
}
Orders
angular.module('orderCloud.sdk).factory(Orders, OrdersFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List Outgoing Orders
OrderCloud.Orders.ListOutgoingOrders(listArgs,from,to).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |from|date|Lower bound of date range that the order was created (if outgoing) or submitted (if incoming).| |to|date|Upper bound of date range that the order was created (if outgoing) or submitted (if incoming).| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
]
}
List Incoming Orders
OrderCloud.Orders.ListIncomingOrders(listArgs,from,to).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |from|date|Lower bound of date range that the order was created (if outgoing) or submitted (if incoming).| |to|date|Upper bound of date range that the order was created (if outgoing) or submitted (if incoming).| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
]
}
Get Order
OrderCloud.Orders.GetOrder(orderID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.|
Response Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
Promotions
angular.module('orderCloud.sdk).factory(Promotions, PromotionsFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List Promotions
OrderCloud.Promotions.ListPromotions(listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Code": "…",
"Name": "…",
"RedemptionLimit": null,
"RedemptionLimitPerUser": null,
"RedemptionCount": 0,
"Description": "…",
"FinePrint": "…",
"StartDate": null,
"ExpirationDate": null,
"EligibleExpression": "…",
"ValueExpression": "…",
"CanCombine": false,
"xp": null
}
]
}
Get Promotion
OrderCloud.Promotions.GetPromotion(promotionID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |promotionID|string|ID of the promotion.|
Response Body Sample
{
"ID": "…",
"Code": "…",
"Name": "…",
"RedemptionLimit": null,
"RedemptionLimitPerUser": null,
"RedemptionCount": 0,
"Description": "…",
"FinePrint": "…",
"StartDate": null,
"ExpirationDate": null,
"EligibleExpression": "…",
"ValueExpression": "…",
"CanCombine": false,
"xp": null
}
SpendingAccounts
angular.module('orderCloud.sdk).factory(SpendingAccounts, SpendingAccountsFactory)
"Me" is a container for read-only endpoints that return a filtered view of things that the current buyer user is allowed to see, i.e. things that they are assigned to either directly or as a member of a buyer organization or user group. It also provides ways for a user to update or change their own information.
List Spending Accounts
OrderCloud.SpendingAccounts.ListSpendingAccounts(listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Name": "…",
"Balance": 0.0,
"AllowAsPaymentMethod": false,
"RedemptionCode": "…",
"StartDate": null,
"EndDate": null,
"xp": null
}
]
}
Get Spending Account
OrderCloud.SpendingAccounts.GetSpendingAccount(spendingAccountID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |spendingAccountID|string|ID of the spending account.|
Response Body Sample
{
"ID": "…",
"Name": "…",
"Balance": 0.0,
"AllowAsPaymentMethod": false,
"RedemptionCode": "…",
"StartDate": null,
"EndDate": null,
"xp": null
}
Orders
angular.module('orderCloud.sdk).factory(Orders, OrdersFactory)
An Order represents a business transaction between two parties. It typically consists of a collection of Line Items, a Payment Method, Tax and Shipping information, etc. The OrderCloud platform defines various "actions" that can be performed against Orders, such as Submit, Approve, Ship, etc. These actions transform the state of the order and often trigger external events such as financial transactions.
Get a Single Order
OrderCloud.Orders.Get(orderID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.|
Response Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
Create New Order
OrderCloud.Orders.Create(order).then(successFn).catch(errorFn);
Request Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"BillingAddressID": "…",
"ShippingAddressID": "…",
"Comments": "…",
"ShippingCost": 0.0,
"TaxCost": 0.0,
"xp": null
}
Create or Update Order
OrderCloud.Orders.Update(orderID,order).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.|
Request Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"BillingAddressID": "…",
"ShippingAddressID": "…",
"Comments": "…",
"ShippingCost": 0.0,
"TaxCost": 0.0,
"xp": null
}
Delete Order
OrderCloud.Orders.Delete(orderID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.|
List Outgoing
OrderCloud.Orders.ListOutgoing(from,to,listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |from|date|Lower bound of date range that the order was created.| |to|date|Upper bound of date range that the order was created.| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
]
}
List Incoming
OrderCloud.Orders.ListIncoming(from,to,listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |from|date|Lower bound of date range that the order was submitted.| |to|date|Upper bound of date range that the order was submitted.| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
]
}
List Approvals
OrderCloud.Orders.ListApprovals(orderID,listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ApprovalRuleID": "…",
"ApprovingGroupID": "…",
"Status": "Pending",
"DateCreated": "0001-01-01T00:00:00+00:00",
"DateCompleted": null,
"ApproverID": "…",
"ApproverUserName": "…",
"ApproverEmail": "…",
"Comments": "…"
}
]
}
List Eligible Approvers
OrderCloud.Orders.ListEligibleApprovers(orderID,listArgs).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.| |search|string|Word or phrase to search for.| |searchOn|string|Comma-delimited list of fields to search on.| |sortBy|string|Comma-delimited list of fields to sort by.| |page|integer|Page of results to return. Default: 1| |pageSize|integer|Number of results to return per page. Default: 20, max: 100.| |filters||Any additional key/value pairs passed in the query string are interpretted as filters. Valid keys are top-level properties of the returned model or 'xp.???'|
Response Body Sample
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 25,
"TotalPages": 2,
"ItemRange": [
1,
20
]
},
"Items": [
{
"ID": "…",
"Username": "…",
"FirstName": "…",
"LastName": "…",
"Email": "…",
"Phone": "…",
"TermsAccepted": null,
"Active": false,
"xp": null,
"AvailableRoles": [
"…"
]
}
]
}
Partially Update Order
OrderCloud.Orders.Patch(orderID,partialOrder).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.|
Request Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"BillingAddressID": "…",
"ShippingAddressID": "…",
"Comments": "…",
"ShippingCost": 0.0,
"TaxCost": 0.0,
"xp": null
}
Submit Order
OrderCloud.Orders.Submit(orderID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.|
Response Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
Approve Order
OrderCloud.Orders.Approve(orderID,comments).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.| |comments|string|Comments to be saved with the order approval.|
Response Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
Decline Order
OrderCloud.Orders.Decline(orderID,comments).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.| |comments|string|Comments to be saved with the order denial.|
Response Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost": 0.0,
"TaxCost": 0.0,
"PromotionDiscount": 0.0,
"Total": 0.0,
"IsSubmitted": false,
"xp": null
}
Cancel Order
OrderCloud.Orders.Cancel(orderID).then(successFn).catch(errorFn);
Parameters
| Name | Type | Description | | -------------- | ----------- | --------------- | |orderID|string|ID of the order.|
Response Body Sample
{
"ID": "…",
"Type": "Standard",
"FromUserID": "…",
"FromUserFirstName": "…",
"FromUserLastName": "…",
"BillingAddressID": "…",
"BillingAddress": {
"ID": "…",
"CompanyName": "…",
"FirstName": "…",
"LastName": "…",
"Street1": "…",
"Street2": "…",
"City": "…",
"State": "…",
"Zip": "…",
"Country": "…",
"Phone": "…",
"AddressName": "…",
"xp": null
},
"ShippingAddressID": "…",
"Comments": "…",
"LineItemCount": 0,
"Status": "Unsubmitted",
"DateCreated": null,
"DateSubmitted": null,
"DateApproved": null,
"DateDeclined": null,
"DateCanceled": null,
"DateCompleted": null,
"Subtotal": 0.0,
"ShippingCost":