r/httr通行证列表以发布查询
我正在尝试使用url https:/https:/https:/ /swisstaxcalculator.estv.admin.ch/#/calculator/income-wealth-tax
使用浏览器检查器我知道,我知道查询应该像这样:
{
"SimKey": null,
"TaxYear": 2021,
"TaxLocationID": 100000000,
"Relationship": 1,
"Confession1": 5,
"Children": [
{
"Age": 6
},
{
"Age": 11
}
],
"Confession2": 0,
"TaxableIncomeCanton": 30000,
"TaxableIncomeFed": 30000,
"TaxableFortune": 0
}
我正在使用以下查询,但是孩子们的参数是被忽略。如您所见,我已经进行了多次尝试,但无效。.
url <- https://swisstaxcalculator.estv.admin.ch/delegate/ost-integration/v1/lg-proxy/operation/c3b67379_ESTV/API_calculateSimpleTaxes
httr::POST(url,
body = list(
SimKey = NULL,
TaxYear = 2021,
TaxLocationID = 100000000,
Relationship = 1,
Confession1 = 5,
# Children = list("Age" = 6, "Age" = 11),
# Children = array(c(6,11), dimnames = list(c("Age", "Age"))),
Children ='[{Age:6,Age:11}]',
Confession2 = 0,
TaxableIncomeCanton = 30000,
TaxableIncomeFed = 30000,
TaxableFortune = 0
),
encode = "json")
有人可以帮助我弄清楚如何通过孩子的争论吗?使用计算器,我知道响应应如下以下:
{"response":{"IncomeSimpleTaxCanton":1138,"FortuneTaxCanton":0,"IncomeSimpleTaxCity":1138,"IncomeTaxChurch":0,"IncomeTaxCity":893,"IncomeSimpleTaxFed":0,"PersonalTax":0,"FortuneTaxCity":0,"FortuneSimpleTaxCanton":0,"IncomeTaxFed":0,"FortuneSimpleTaxCity":0,"IncomeTaxCanton":1763,"Location":{"TaxLocationID":100012001,"ZipCode":"1000","BfsID":5586,"CantonID":23,"BfsName":"Lausanne","City":"Chailly-sur-Laus","Canton":"VD"},"FortuneTaxChurch":0}}
I am trying to query the tax calculator for my country using url https://swisstaxcalculator.estv.admin.ch/#/calculator/income-wealth-tax
Using browser inspector I know that the query should look something like this:
{
"SimKey": null,
"TaxYear": 2021,
"TaxLocationID": 100000000,
"Relationship": 1,
"Confession1": 5,
"Children": [
{
"Age": 6
},
{
"Age": 11
}
],
"Confession2": 0,
"TaxableIncomeCanton": 30000,
"TaxableIncomeFed": 30000,
"TaxableFortune": 0
}
I'm using the following query in R but the Children argument is ignored. As you can see I have made multiple attempts but none works..
url <- https://swisstaxcalculator.estv.admin.ch/delegate/ost-integration/v1/lg-proxy/operation/c3b67379_ESTV/API_calculateSimpleTaxes
httr::POST(url,
body = list(
SimKey = NULL,
TaxYear = 2021,
TaxLocationID = 100000000,
Relationship = 1,
Confession1 = 5,
# Children = list("Age" = 6, "Age" = 11),
# Children = array(c(6,11), dimnames = list(c("Age", "Age"))),
Children ='[{Age:6,Age:11}]',
Confession2 = 0,
TaxableIncomeCanton = 30000,
TaxableIncomeFed = 30000,
TaxableFortune = 0
),
encode = "json")
Can anybody help me figuring out how to pass the Children argument? Using the calculator manually I know the response should be as follows for this input:
{"response":{"IncomeSimpleTaxCanton":1138,"FortuneTaxCanton":0,"IncomeSimpleTaxCity":1138,"IncomeTaxChurch":0,"IncomeTaxCity":893,"IncomeSimpleTaxFed":0,"PersonalTax":0,"FortuneTaxCity":0,"FortuneSimpleTaxCanton":0,"IncomeTaxFed":0,"FortuneSimpleTaxCity":0,"IncomeTaxCanton":1763,"Location":{"TaxLocationID":100012001,"ZipCode":"1000","BfsID":5586,"CantonID":23,"BfsName":"Lausanne","City":"Chailly-sur-Laus","Canton":"VD"},"FortuneTaxChurch":0}}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将儿童年龄作为嵌套清单,从r:
You have to pass the children ages as a nested list from within R: