🌐
MathWorks
mathworks.com › matlab › programming › functions › argument definitions
addParameter - Add optional name-value pair argument into input parser scheme - MATLAB
addParameter(p,paramName,defaultVal) adds the parameter name of an optional name-value pair argument into the input parser scheme.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.management.automation.powershell.addparameter
PowerShell.AddParameter Method (System.Management.Automation) | Microsoft Learn
Adds a switch parameter to the last added command. For example, to construct a command string "get-process | sort-object -descending" PSCommand command = new PSCommand("get-process"). AddCommand("sort-object").AddParameter("descending");
🌐
Micro Focus
admhelp.microfocus.com › uft › en › all › AutomationObjectModel › Content › QTReservedObjects › Output › Parameterization_DTSheet_AddParameter.htm
AddParameter Method - ADM Help Centers
The following example uses the AddParameter method to create the new Parameter, "Arrival" within the new sheet, MySheet of the design-time or run-time data table, and sets the first cell in the column as "New York".
Find elsewhere
🌐
Workrunner
workrunner.github.io › ag › pm › sc › restrequest.addparameter
RestRequest.AddParameter - Workrunner
RestRequest RestRequest.AddParameter ( name, value, [ type ] ) Adds a new parameter to request · String name · Name of parameter · Object value · Value of parameter · String type · Type of parameter. Optional. Name and value arguments are required. Type parameter is optional.
🌐
Unity
docs.unity3d.com › ScriptReference › Animations.AnimatorController.AddParameter.html
Unity - Scripting API: Animations.AnimatorController.AddParameter
public void AddParameter(string name, AnimatorControllerParameterType type); public void AddParameter(AnimatorControllerParameter paramater); Utility function to add a parameter to the controller.
🌐
Microsoft Learn
learn.microsoft.com › en-us › previous-versions › windows › desktop › ms762312(v=vs.85)
addParameter Method | Microsoft Learn
The addParameter method can be called on transformNode handlers and between transform calls (in asynchronous processing), and further processing will use the updated parameter.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › aspire.hosting.parameterresourcebuilderextensions.addparameter
ParameterResourceBuilderExtensions.AddParameter Method (Aspire.Hosting) | Microsoft Learn
<Extension()> Public Function AddParameter (builder As IDistributedApplicationBuilder, name As String, Optional secret As Boolean = false) As IResourceBuilder(Of ParameterResource)
🌐
GitHub
github.com › dotnet › aspire › issues › 4429
AddParameter overloads that supports providing a value · Issue #4429 · dotnet/aspire
June 8, 2024 - namespace Aspire.Hosting; public static class ParameterResourceBuilderExtensions { + public static IResourceBuilder<ParameterResource> AddParameter(this IDistribuedApplicationBuilder builder, string name, string value, bool secret = false); + public static IResourceBuilder<ParameterResource> AddParameter(this IDistribuedApplicationBuilder builder, string name, Func<string> valueGetter, bool secret = false); + public static IResourceBuilder<ParameterResource> AddParameterFromConfiguration(this IDistribuedApplicationBuilder builder, string name, string configurationKey, bool secret = false); + public static IResourceBuilder<ParameterResource> PublishDefaultValue(this IResourceBuilder<ParameterResource> parameter); }
Author: dotnet
Top answer
1 of 3
18

To answer your question

AddQueryParameter adds a parameter in the query string as ParameterType.QueryString whereas AddParameter(string, object) adds the parameter as ParameterType.GetOrPost

For more details on each parameter type, see:

GetOrPost: https://github.com/restsharp/RestSharp/wiki/ParameterTypes-for-RestRequest#getorpost

QueryString: https://github.com/restsharp/RestSharp/wiki/ParameterTypes-for-RestRequest#querystring

To solve your problem

It seems it is unrelated to the type of parameter, because the exception thrown seems to indicate you aren't even connecting to the remote server.

make sure you pass the same apiUrl / myUrl in both cases.

2 of 3
0

To answer the OP and anyone else who might have trouble with the concept. It took me awhile to get around to the concept. You probably need to visualise the RESTful standard of how to construct a GET request message in a url against constructing for a POST request message.

You will notice that for GET , the parameter(s) are attached to the URL header whereas for the POST , the parameter(s) are placed in the body of the message. RestSharp 's method AddQueryParameter() will only add the (Query) parameters in the header of the message, whereas the AddParameter() will only add the parameters to the mesasge body. As demonstrated below the GET has one query parameter with a value of "Flavours" . For the POST , the parameters contact_name and company_name are located in the bottom of the message body.

Eg:

GET message format :

GET http://www.consumerdiarydemo.cbrnetwork.test.au/api/ConsumerDiary/getSizesOrFlavours/Flavours HTTP/1.1 Host: www.consumerdiarydemo.cbrnetwork.test.au Connection: keep-alive Accept: application/json User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Referer: http://www.consumerdiarydemo.cbrnetwork.test.au/ConsumerDiaryPage2template Accept-Encoding: gzip, deflate, sdch Accept-Language: en-GB,en-US;q=0.8,en;q=0.6


POST message format :

POST http://localhost:1234567/api/customers HTTP/1.1 Accept: application/json, text/javascript, /; q=0.01 X-Requested-With: XMLHttpRequest Content-Type: application/x-www-form-urlencoded; charset=UTF-8

{"contact_name":"value_data1","company_name":"value_data2"}

🌐
McNeel Forum
discourse.mcneel.com › scripting
What does Addparameter first parameter? - Scripting - McNeel Forum
October 10, 2013 - In the method addparameter (to add a custom variable type to component as input or out put) what is first parameter and what does it do? it is IGH_param. let’s say my custom type is a class named Library2. protected override void ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › previous-versions › msp-n-p › bb748682(v=pandp.60)
Database.AddParameter Method (DbCommand, String, DbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) (Microsoft.Practices.EnterpriseLibrary.Data) | Microsoft Learn
April 26, 2013 - 'Declaration Public Overridable Sub AddParameter ( command As DbCommand, name As String, dbType As DbType, size As Integer, direction As ParameterDirection, nullable As Boolean, precision As Byte, scale As Byte, sourceColumn As String, sourceVersion As DataRowVersion, value As Object )
🌐
Refactoring.Guru
refactoring.guru › home › techniques › simplifying method calls
Add Parameter
January 1, 2026 - Problem: A method doesn’t have enough data to perform certain actions. Solution: Create a new parameter to pass the necessary data.
🌐
Eplan
eplan.help › en-US › infoportal › content › api › 2.8 › Eplan.EplApi.Baseu~Eplan.EplApi.Base.Context~AddParameter.html
AddParameter Method (Context)
Eplan.EplApi.Base Namespace / Context Class / AddParameter Method · Indicates the name of the parameter. Leading and trailing white-space characters are ignored. Indicates the value of this parameter. Collapse All Expand All Language Filter: All Language Filter: Multiple Language Filter: Visual Basic Language Filter: C# Language Filter: C++/CLI ·