none
need help to pull data using OAUTH2.0 RRS feed

  • Question

  • Hi All,

     I need to pull data from OAUTH2.0 using Script task and script component.I have referred many articles for the same and not able to get any help with them. if someone already worked on it could help me please.

    we cannot use 3rd party paid tools

    SSIS version:2014

    Thanks in advance.

    Friday, August 16, 2019 11:06 AM

All replies

  • OAuth is for authentication, you can not pull data from it  https://en.wikipedia.org/wiki/OAuth

    So what is your exact requirement / service type etc ...? We need more details to assist you.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Friday, August 16, 2019 12:24 PM
  • If you don't want to use third-party tools, you have to implement non-trivial code to make it work.

    SSIS Tasks Components Scripts Services | http://wwww.cozyroc.com/

    Friday, August 16, 2019 1:01 PM
  • Hi Olaf helper,

    Thanks for the helping hand!!

    Actually I am looking how can we generate authentic key using script  task or script component.

    Friday, August 16, 2019 3:24 PM
  •  I need to pull data from OAUTH2.0 using Script task and script component.I have referred many articles for the same and not able to get any help with them. if someone already worked on it could help me please...

    I do not understand why Script task AND Script Component.

    Likely it is the latter as you want to process the rows on the fly. I also do not see why don't you share the source for the OAUTH or at the very least the vendor.

    So a lot of unknowns.

    But in general you need to borrow code from an example like https://gist.github.com/danieljarolim/1b6e2c2575f17d8a477f3135d36f99c9


    Arthur

    MyBlog


    Twitter

    Friday, August 16, 2019 3:33 PM
    Moderator
  • how can we generate authentic key

    That's really nothing SSIS related, better ask this in a more related forum, like one for webservices.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Friday, August 16, 2019 3:44 PM
  • Hi Arthur,

    Thanks for the reply!!

    Might be i need to rephrase my question, we  need pull data from TAP API, where we need to pass authentic key + secret key in the web service url. Authentic key validity is only 15 mins and for every 15 mins i need to regenerate new authentic key. So i am looking for how can we generate authentic key using script Component.

    FYI.. i am able to pull the data using direct API, PFB script for the same. But i am looking more into how can i add authentic key into below API code.

    #region Help:  Introduction to the Script Component
    /* The Script Component allows you to perform virtually any operation that can be accomplished in
     * a .Net application within the context of an Integration Services data flow.
     *
     * Expand the other regions which have "Help" prefixes for examples of specific ways to use
     * Integration Services features within this script component. */
    #endregion

    #region Namespaces
    using System;
    using System.Data;
    using System.Net;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;
    #endregion

    /// <summary>
    /// This is the class to which to add your code.  Do not change the name, attributes, or parent
    /// of this class.
    /// </summary>
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
    public class ScriptMain : UserComponent
    {
        

        /// <summary>
        /// This method is called once, before rows begin to be processed in the data flow.
        ///
        /// You can remove this method if you don't need to do anything here.
        /// </summary>
        public override void PreExecute()
        {
            base.PreExecute();
            try
            {
                //denodoJSONRequest = new WebClient();
                //denodoJSONRequest.UseDefaultCredentials = true;
                //denodoJSONRequest.Credentials = new NetworkCredential(denodoUser, denodoPsswd);
                //denodoJSONResponse = denodoJSONRequest.DownloadString(DenodoRequestURL);



            }
            catch (Exception ex)
            {

            }
        }



        /// <summary>
        /// This method is called after all the rows have passed through this component.
        ///
        /// You can delete this method if you don't need to do anything here.
        /// </summary>
        public override void PostExecute()
        {
            base.PostExecute();
            /*
             * Add your code here
             */
        }

        public override void CreateNewOutputRows()
        {
            string DenodoRequestURL = Variables.PDenodoURL;
            string denodoUser = Variables.PDenodoUser;
            string denodoPsswd = Variables.PDenodoPsswd;
            WebClient denodoJSONRequest;
        string denodoJSONResponse;
    denodoJSONRequest = new WebClient();
                denodoJSONRequest.UseDefaultCredentials = true;
                denodoJSONRequest.Credentials = new NetworkCredential(denodoUser, denodoPsswd);
                denodoJSONResponse = denodoJSONRequest.DownloadString(DenodoRequestURL);

            if (!String.IsNullOrEmpty(denodoJSONResponse))
            {
                JObject jsonObject = JObject.Parse(denodoJSONResponse);
                JToken jsonElements = jsonObject["elements"];
                   foreach (var json in jsonElements)
                    {
                        DenodoResponseBuffer.AddRow();
                        DenodoResponseBuffer.column1 = int.Parse(json["column1"].ToString().Trim());
                        DenodoResponseBuffer.column2 = int.Parse(json["column2"].ToString().Trim());
                        DenodoResponseBuffer.column3 = json["column3"].ToString().Trim();
                        DenodoResponseBuffer.column4 = json["column4"].ToString().Trim();
                        DenodoResponseBuffer.column5 = DateTime.Parse(json["column5"].ToString().Trim());
                        DenodoResponseBuffer.column6 = DateTime.Parse(json["column6"].ToString().Trim());
                    }

                

                
            }





        }

    }

    Sunday, August 18, 2019 10:28 AM
  • Hi vasu_479,

    The following link will be helpful:

    Generate a SSIS-package that reads from Twitter using Biml

    Best Regards,

    Mona


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, August 19, 2019 8:16 AM