AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • In-Person Gatherings
    • Power BI Workshop
    • Podcast
    • Rolodex
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Everything Else
Contract Based REST...
 
Notifications
Clear all

Questions Contract Based REST API to GET StockItem Attributes

 
Everything Else
Last Post by Tim Rodman 5 years ago
5 Posts
3 Users
1 Reactions
4,448 Views
RSS
JohnSP
Posts: 2
 JohnSP
Topic starter
November 30, 2020 11:55 pm
(@johnsp)
New Member
Joined: 5 years ago

Does anyone have experience and examples to share using the Contract Based REST API to get StockItem attribute values from an Acumatica instance? I’m able to retrieve StockItem data via the REST API but have not figured out how to get Attributes or their values.

This GET request works fine. It returns a 200 code and a nice json string with the expected data from our 2019R1 instance:
http://10.1.1.22/alive/entity/Default/17.200.001/StockItem?$filter=startswith(InventoryID ,'IDDG')&$top=5&$expand=Boxes

But when I try to retrieve attribute IDs or values from StockItems, Acumatica returns a 500 code without much to go on. I tried following the instructions in the Integration Development Guide but it isn’t real clear on this topic. I must have something wrong with the GET request syntax. Here I’m trying to get the value of the StockItem Attribute named A1007:
http://10.1.1.22/alive/entity/Default/17.200.001/StockItem?$expand=Attributes&$Custom=Document.AttributeA1007&$top=10


4 Replies
programfred
Posts: 45
 programfred
December 9, 2020 1:02 am
(@programfred)
Trusted Member
Joined: 6 years ago

Made this request a few months ago. 

If I remember right, you can not expand the Attributes only. you have expand all the fields include custom fields. that made the request very large.

or you can have another endpoint to request the attribute, and combine the data on somewhere else.


Reply
JohnSP
 JohnSP
(@johnsp)
Joined: 5 years ago

New Member
Posts: 2
December 21, 2020 12:36 am
Reply toprogramfredprogramfred

@programfred

Thanks for your reply. It gave me a clue.

I did some more research and learned, if I’m understanding the documentation correctly, that you can’t expose attributes using a regular get request that returns multiple records. Attributes can only be exposed when retrieving one record by key. So to get the attributes for a stock item, I used two get requests, first to get the item id (which is different for each session) based on the InventoryCD and second using the id to get the item attributes.

Here's an example for the stock item IDDGLD08 that works:

#1 Get the item ID:

http://10.1.1.22/instance/entity/Default/17.200.001/StockItem?$select=InventoryID&$filter=InventoryID eq 'IDDGLD08'

This returns data that includes “836a2bb8-ed0e-4aa3-a582-388f90f99740” for the key.

#2 Get the item data including attributes using the id:

http://10.1.1.22/instance/entity/Default/17.200.001/StockItem/836a2bb8-ed0e-4aa3-a582-388f90f99740?$expand=Attributes&$select=InventoryID,Attributes/AttributeID,Attributes/Value

Alternatively, the oData interface can be used to get stock item data, including attributes, from a correctly constructed, exposed, generic inquiry.


Reply
programfred
 programfred
(@programfred)
Joined: 6 years ago

Trusted Member
Posts: 45
December 21, 2020 6:35 pm
Reply toJohnSPJohnSP
programfred

@johnsp

Yes John, I built a GI and expose to OData. about 3-5s i can request about 4000 records.

much faster then restful API.


Reply
Tim Rodman reacted
Tim Rodman
 Tim Rodman
Admin
(@timrodman)
Joined: 10 years ago

Famed Member
Posts: 3204
March 15, 2021 4:31 am
Reply toprogramfredprogramfred
JohnSP
programfred

@programfred and @johnsp,

I think that OData also has the advantage of not being restricted by licensing limitations like API calls are as shown in this slide screenshot:

https://twitter.com/TimRodman/status/1204511100500414464


Reply
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,530 Topics
  • 11 K Posts
  • 12 Online
  • 2,418 Members
Our newest member: Chad Treadwell
Latest Post: Negative/Credit Inventory Value?
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

  • Johnny Tang Dominic Boullé
Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2026 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×