Generic List and x-www-form-urlencoded REST API

wait
Member Posts: 53
Hi, I what I need to do is call REST API using x-www-form-urlencoded body to get a token that I can use calling other services, I'm using Http Client but what I can't figure out is how to create a list of the type <string><string> in NAV.
Edit, I'm trying to use Dictionary to achieve this System.Collections.Generic.Dictionary`2.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Does anyone have a clue how I can achieve this without writing my own dll?
The request I need to do:

What I have so far:

Edit, I'm trying to use Dictionary to achieve this System.Collections.Generic.Dictionary`2.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Does anyone have a clue how I can achieve this without writing my own dll?
The request I need to do:

What I have so far:

0
Best Answer
-
And the price goes to Vjeko
for the following blog: https://vjeko.com/2012/05/17/generics-in-net-interop-for-nav-2013/
The working code:
0
Answers
-
And the price goes to Vjeko
for the following blog: https://vjeko.com/2012/05/17/generics-in-net-interop-for-nav-2013/
The working code:
0 -
How would I implement this in AL code without the Dotnet variables?0
-
HttpClient is now a native datatype in BC. See Docs for al the available methods. https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/httpclient/httpclient-data-type0
-
irasoeirasoelbaks wrote: »HttpClient is now a native datatype in BC.
Like he said @irasoelbaks ,
Dictionary is also a datatype in BC
https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/dictionary/dictionary-data-type
0 -
I can see that Dictionary is a datatype and could be generated with values however FormURLEncodedContent is not as far as I am aware available in BC so how would the Dictionary be implemented as it is using the DotNet interop example above?
0 -
I can see that Dictionary is a datatype and could be generated with values however FormURLEncodedContent is not as far as I am aware available in BC so how would the Dictionary be implemented as it is using the DotNet interop example above?
Hi @jimmyf, you should be able to use the "Type Helper" codeunit function "UrlEncode". Look at the last example on this page. https://www.kauffmann.nl/2017/07/18/al-web-service-examples/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions