0

I need to trigger a ADF Pipeline via REST API and pass a parameter in order to execute the pipeline for the given ID (parameter). With sparse documentation around this, I am unable to figure out how to pass parameters to the URL

Sample:

https://management.azure.com/subscriptions/asdc57878-77fg-fb1e8-7b06-7b0698bfb1e8/resourceGroups/dev-rg/providers/Microsoft.DataFactory/factories/df-datafactory-dev/pipelines/pl_StartProcessing/createRun?api-version=2018-06-01 

I tried to send parmaters in the request body but I get the following message depending on how params are sent

{ "message": "The request entity's media type 'text/plain' is not supported for this resource." } 

I tried using python requests :

import requests url = "https://management.azure.com/subscriptions/adsad-asdasd-adasd-adasda-adada/resourceGroups/dev-rg/providers/Microsoft.DataFactory/factories/datafactory-dev/pipelines/pl_Processing/createRun?api-version=2018-06-01" payload = " \"parameters\": {\r\n “stateID”: “78787878”\r\n}" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer adsasdasdsad' } response = requests.request("POST", url, headers=headers, data = payload) print(response.text.encode('utf8')) 

I tried to put the parameter in the payload (body)

5
  • Which parameter do you want to use? The given ID you mean referencePipelineRunId? Could you show your complete request sample, Including the body? Commented Aug 12, 2020 at 1:44
  • The pipeline expects Stateid as a parameter. This is a custom pipeline parameter instead of a URI parameter Commented Aug 12, 2020 at 3:22
  • Could you update your question with the sample request you have tried? Commented Aug 12, 2020 at 4:00
  • Added sample code. It is python based. Commented Aug 12, 2020 at 14:25
  • @JoyWang any suggestions on this ? Thanks in advance Commented Aug 13, 2020 at 14:06

3 Answers 3

1

Paramters can be passed within body

python sample:

import requests url = "https://management.azure.com/subscriptions/adsad-asdasd-adasd-adasda-adada/resourceGroups/dev-rg/providers/Microsoft.DataFactory/factories/datafactory-dev/pipelines/pl_Processing/createRun?api-version=2018-06-01" payload = "{\"stateID\":1200}" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer adsasdasdsad' } response = requests.request("POST", url, headers=headers, data = payload) print(response.text.encode('utf8')) 
Sign up to request clarification or add additional context in comments.

Comments

0

You have to use a parameter name as post

url = "https://management.azure.com/subscriptions/adsad-asdasd-adasd-adasda-adada/resourceGroups/dev-rg/providers/Microsoft.DataFactory/factories/datafactory-dev/pipelines/pl_Processing/createRun?api-version=2018-06-01 -d '{"stateID"="78787878"}' 

microsoft docs for your reference : https://learn.microsoft.com/en-us/rest/api/datafactory/pipelines/create-run

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

You have to pass them as the POST body.
To pass more than one parameter the body this looks like:

{ 

"param1": "param1value" ,"param2":"param2value" }

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.