Login to Rest API using Azure Data Factory

New Contributor

I am trying to set up a new ADF pipeline to connect to a REST API and extract the data. It has to happen in following steps:

 

1. Call the Login API  (returns sessionid)

2. Use the sessionid to call the SalesAPI (returns Sales json)

 

I have tested the code in Python, but somehow not able to configure the Source in ADF pipeline and linked Service. I need some help configuring for Login API call.

 

In python the code (for login) looks like this:

 

#################################

baseurl = "https://url/v1/"
loginurl = "reports/login"

actionurlpart = loginurl
url = baseurl + actionurlpart
 
 headers = {
            "Content-Type": "application/x-www-form-urlencoded",
            "Accept": "application/json"
        }

        queryparams = {
            "apikey": self.__apikey
        }

        bodyparams = {
            "username":self.__username,
            "password":self.__passwordEncoded,
            "market":self._market
 
        }

        response = requests.request(
            "POST"
            , url = url
            , headers=headers
            , params=queryparams
            , data=bodyparams
        )


dictResp = json.loads(response.text)
 

#################################

 

Can someone help me with configuring the ADF linked service and Copy Data to get the sessionid.

 

0 Replies