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

— The Forums are now read-only —

— All new activity now takes place here: —

AugForums.com Discord Server
Forums
AUG Forums
Everything Else
Initial REST Setup
 
Notifications
Clear all

Questions Initial REST Setup

 
Everything Else
Last Post by Tim Rodman 8 years ago
5 Posts
2 Users
0 Reactions
5,179 Views
RSS
mhoss
Posts: 34
 mhoss
Topic starter
February 23, 2018 2:00 am
(@mhoss)
Trusted Member
Joined: 5 years ago

Hey Tim, great posts on REST. I've had a lot of ideas and now I'm trying to get started.

I downloaded Postman and tried to post to our instance of Acumatica - 

https://thomson.nellnube.com/HTSLabs/

Type: No Auth

Body: 

{
"name" : "test",
"password" : "*******",
"company" : "SANDBOXTHOMSON"
}

I'm getting a 401 unauthorized user error. What am I missing?
I also tried  https://thomson.nellnube.com/HTSLabs/entity/auth/login without luck.

Any ideas?

Thanks,
Matt

 


4 Replies
Tim Rodman
Posts: 3204
 Tim Rodman
Admin
February 23, 2018 10:46 pm
(@timrodman)
Famed Member
Joined: 11 years ago

JSON looks good to me. But try this URL:

https://thomson.nellnube.com/HTSLabs/entity/auth/login /p>


Reply
mhoss
 mhoss
(@mhoss)
Joined: 5 years ago

Trusted Member
Posts: 34
February 24, 2018 2:11 am
Reply toTim RodmanTim Rodman

Alright, got it working! I was passing it as text instead of JSON.

On to part 2. I can get the sales order info with the following get -

https://thomson.nellnube.com/HTSLabs/entity/default/6.00.001/SalesOrder?$top=5

But if I try for detail, with this get - 

https://thomson.nellnube.com/HTSLabs/entity/default/6.00.001/SalesOrder?$top=5&$expand=SalesOrderDetail

Postman errors on me - 

"message": "An error has occurred.",
"exceptionMessage": "The given key was not present in the dictionary.",
"exceptionType": "System.Collections.Generic.KeyNotFoundException",

I was reading through I210, but it's light on REST documentation. What are your thoughts? 

 

Full error txt:

{
"message": "An error has occurred.",
"exceptionMessage": "The given key was not present in the dictionary.",
"exceptionType": "System.Collections.Generic.KeyNotFoundException",
"stackTrace": " at System.ThrowHelper.ThrowKeyNotFoundException()\r\n at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at Microsoft.Data.OData.Query.SyntacticAst.ExpandBinder.GenerateExpandItem(ExpandTermToken tokenIn)\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\r\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n at Microsoft.Data.OData.Query.SyntacticAst.ExpandBinder.Bind(ExpandToken tokenIn)\r\n at Microsoft.Data.OData.Query.SelectExpandSemanticBinder.Parse(IEdmEntityType elementType, IEdmEntitySet entitySet, ExpandToken expandToken, SelectToken selectToken, ODataUriParserConfiguration configuration)\r\n at PX.Api.ContractBased.OData.Helpers.ParseSelectCustomAndExpand(ODataUriParser uriParser, String select, String expand, String custom, IEdmEntityType elementType, EntityImpl entity, Nullable`1 returnBehaviorToSet)\r\n at PX.Api.ContractBased.OData.Helpers.FillRestQueryOptions(IEdmModel edmModel, EntityImpl entity, String filter, String select, String expand, String custom)\r\n at PX.Api.ContractBased.SystemContracts.V2.RestController.GetList(String objectName, String select, String filter, String expand, String custom, Nullable`1 skip, Nullable`1 top)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"


Reply
mhoss
 mhoss
(@mhoss)
Joined: 5 years ago

Trusted Member
Posts: 34
February 24, 2018 2:30 am
Reply tomhossmhoss
Tim Rodman

Marching along... apparently it's $expand=Details (and not the object name SalesOrderDetails)

Full get request -

https://thomson.nellnube.com/HTSLabs/entity/default/6.00.001/SalesOrder?$top=5&$expand=Details

Thanks!


Reply
Tim Rodman
Posts: 3204
 Tim Rodman
Admin
February 26, 2018 12:04 pm
(@timrodman)
Famed Member
Joined: 11 years ago

Interesting. I didn't realize that you could get the details for a batch of records. I thought you could only get them for a specific record.

You can see another example by clicking here and searching for "expanding".


Reply
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,533 Topics
  • 11 K Posts
  • 137 Online
  • 2,439 Members
Our newest member: Ralph Torres
Latest Post: Nested SubReport Issue
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

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

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

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

‹›×

    ‹›×