Calling Kaizala(REST API) using RestSharp DLL

sunmorningindia
Member Posts: 65
Hi,
For demo purpose I am trying to call Kaizala Rest APIs (https://docs.microsoft.com/en-us/Kaizala/).
I want to use RestSharp(http://restsharp.org/) DLL for this purpose. I tried with following code:
Variables
Client DotNet RestSharp.RestClient.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
Request DotNet RestSharp.RestRequest.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
Method DotNet RestSharp.Method.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
ParameterType DotNet RestSharp.ParameterType.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
Response DotNet RestSharp.RestResponse.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
CAL Code
Client := Client.RestClient(STRSUBSTNO(GeneratePinURLTxt,ApiRoot));
Request := Request.RestRequest(Method.POST);
Request.AddHeader('postman-token', GetPostmanToken);
Request.AddHeader('cache-control', 'no-cache');
Request.AddHeader('content-type', 'application/json');
Request.AddParameter('application/json',GetGeneratePinParameter,ParameterType.RequestBody);
Response := Client.Execute(Request);
Compilation error for last line :
Microsoft Dynamics NAV Development Environment
The call is ambiguous between the following methods:'Execute(IRestRequest request)'and'Execute(IRestRequest request)'
OK
Thanks in advance.
Manish Sinha
For demo purpose I am trying to call Kaizala Rest APIs (https://docs.microsoft.com/en-us/Kaizala/).
I want to use RestSharp(http://restsharp.org/) DLL for this purpose. I tried with following code:
Variables
Client DotNet RestSharp.RestClient.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
Request DotNet RestSharp.RestRequest.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
Method DotNet RestSharp.Method.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
ParameterType DotNet RestSharp.ParameterType.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
Response DotNet RestSharp.RestResponse.'RestSharp, Version=106.0.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75'
CAL Code
Client := Client.RestClient(STRSUBSTNO(GeneratePinURLTxt,ApiRoot));
Request := Request.RestRequest(Method.POST);
Request.AddHeader('postman-token', GetPostmanToken);
Request.AddHeader('cache-control', 'no-cache');
Request.AddHeader('content-type', 'application/json');
Request.AddParameter('application/json',GetGeneratePinParameter,ParameterType.RequestBody);
Response := Client.Execute(Request);
Compilation error for last line :
Microsoft Dynamics NAV Development Environment
The call is ambiguous between the following methods:'Execute(IRestRequest request)'and'Execute(IRestRequest request)'
OK
Thanks in advance.
Manish Sinha
0
Answers
-
This normally seems to be a constructor Issue and specially constructor with same number of parameters but different arguments.
Cross verify the Constructor that you are calling.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
I tried with other version of RestSharp.DLL but no luck.0
-
Unfortunately, C/AL is unable to identify the “Execute()” method’s overloads, which results in the known “The function call was ambiguous” error. To solve this, you could wrap it in a small custom .NET dll, which consists of the following couple of lines:
using RestSharp; namespace Comsol { public static class ApiHelper { public static IRestResponse ExecuteRestCall(ref RestClient restClient, ref RestRequest restRequest) { return restClient.Execute(restRequest); } } }
fully explained here:
https://www.j3ns.de/d365-business-central/calling-graphql-queries-in-dynamics-nav-using-restsharp/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