Datasource binding with parameters - Extension azure

Jhon Faber Grisales Patino 1 Reputation point
2020-11-15T14:50:46.01+00:00

Hello,

I'm build a extension and I requiere call API Rest service dynamically, for this I try as:

my datasources:
"dataSources": [
{
"name": "environments",
"endpointUrl": "{{endpoint.url}}/v2/configurations?count=100&offset=0&scope=me",
"resultSelector": "jsonpath:$.[].id",
},
{
"name": "hostnames",
"endpointUrl": "{{endpoint.url}}/v2/configurations/$(environment).json",
"resultSelector": "jsonpath:$.vms[
].name"
}
]

and my inputs and dataSource Bindings in the json task are:

"inputs": [{
"name": "environment",
"defaultValue": "",
"type": "pickList",
"label": "Nombre del Ambiente",
"required": true,
"properties": {
"EditableOptions": "True"
},
"helpMarkDown": "Selecione el nombre del Ambiente a actualizar."
},
{
"name": "hostname",
"defaultValue": "",
"type": "pickList",
"label": "Nombre de máquina",
"required": true,
"helpMarkDown": "Seleccione el nombre de la máquina",
"properties": {
"EditableOptions": "True"
}
}
],

"dataSourceBindings": [
{
"target": "environment",
"endpointId": "$(TestService)",
"dataSourceName": "environments"

        },
        {
            "target": "hostname",
            "endpointId": "$(TestService)",
            "dataSourceName": "hostnames",
            "parameters": {
                "environment": "$(environment)"
            }
        }
    ],

.....

but when I put the "environment" input and reload input "hostname" the response from javascript console is:
{
"$id": "1",
"innerException": null,
"message": "Variable with name environment could not be found for the given service connection.",
"typeName": "Microsoft.VisualStudio.Services.ServiceEndpoints.WebApi.ServiceEndpointException, Microsoft.VisualStudio.Services.ServiceEndpoints.WebApi",
"typeKey": "ServiceEndpointException",
"errorCode": 0,
"eventId": 3000
}

What can I be doing wrong so that the parameter is not sent?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
38,659 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,416 Reputation points
    2020-11-16T06:02:39.787+00:00

    Hi JhonFaberGrisalesPatino,

    Our forum is discussing about visual studio extension, so your question is beyond our support. We recommend you post this question on developer community, and the community members will provide dedicated support for you.

    Best Regards,
    Dylan
    ---
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.