Calling API from SQL Server - sql

I'm new to SQL Server. I would like to pull data from an AppsFlyer website, which requires some information like date in the format yyyy-MM-dd and an API key.
Here's a example of the API I need to use:
https://hq.appsflyer.com/export/br.com.mottu/partners_report/v5?api_token={Account owner API key should be used}&from=yyyy-mm-dd&to=yyyy-mm-dd
Here's the website
https://support.appsflyer.com/hc/en-us/articles/207034346-Pull-APIs-Pulling-AppsFlyer-Reports-by-APIs

Related

Passwordless authentication within SAS pass-through statements?

Thanks to SAS's Personal Login Manager, the initial connection to the remote server works without password (or password hash). However, it seems to be necessary to specify the passwords of the individual databases (user xxuser password xxpwd, see example below).
Is there a way connecting to different databases on a database server without password (hash) in the SAS code?
/* Connect to database server works without password
thanks to SAS's Personal Login Manager */
%dosignon(srvcomponent=xxxremoteSAS);
/* SQL direct pass-through to server */
rsubmit;
/* Define SAS-libraries (on server) */
libname remote_db_a db2 dsn=dbxa schema=xxschema1 user=xxuser password= "xxpwd";
libname remote_db_b db2 dsn=dbxa schema=xxschema2 user=xxuser password= "xxpwd";
endrsubmit;
/* Link local library names with the ones the server */
libname remote_db_a a libref=remote_db_a server=&sessid.;
libname remote_db_b a libref=remote_db_b server=&sessid.;
A work-around is to encode the password string with proc pwencode in="plaintextPassword"; run; and to use this hash instead of xxpwd in the soruce code. A potential attacker can now no longer use the password to access other accounts, but of course can still access any database.
PS: I am new to SAS, so the SAS documentation looks like a book with seven seals to me. I asked various SAS experts, but I am not satisfied with the password-hashing suggestion.
Related questions and answers:
SAS SQL Pass Through
ODBC Password Security in SAS
I am not an expert on how SAS Metadata Manager manages access credentials, but as long as the "remote" SAS session also uses Metadata Manager then you should be able to use it to make your connections.
Here is a blog post about the Personal Login Manager you mentioned.
https://platformadmin.com/blogs/paul/2010/11/sas-personal-login-manager/
At the end of the discussion there is an example of how to create a libref using the metadata manager to supply the credentials
From a user perspective to use the (outbound login) credentials to get
access to third party systems look for authentication domain support
in the SAS feature you are using. For example SAS/ACCESS AUTHDOMAIN=
LIBNAME Option.
https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=acreldb&docsetTarget=n0aiq25zc8u8u6n1i81my0a24sd3.htm&locale=en
Example from that page:
options metauser="metadata-userid" metapass="metadata-password"
metaport=8561 metaprotocol=bridge
metarepository="metadata-repository"
metaserver="server-name";
libname A1 saphana server=mysrv1 port=30015 authodomain="hanaauth";

What is the best way to copy a set of records from Oracle to SQL Server using code where table and columns are identical?

Basic idea is we have our Silverlight application, and need to provide data to third party application when user want to send (export) a record of T_MainList
We maintain our data in Oracle and third party's SQL Server, third party people are providing us access to write a stored procedure, and a web service if needed.
Same table schema is maintained on both databases (Oracle and SQL Server), need to copy a record of T_MAINLIST on user request and it has other dependent data sublist can have multiple records and each sublist record can have multiple subsublist records
Is serializing data of whole dataset as xml and send them in stored procedure. De-serialized data in stored procedure (on SQL server) and insert data into the appropriate tables good idea?
Oracle has the possibility to directly connect to another database, see the example for MS SQL server here. That should be faster then using xml ex- and import...

Pentaho Get data via http GET or POST request

I have a nodejs server that uses tds to connect to a sqlserver database and returns the requested query in xml or json format.
The request would be in http and include the sql query i.e.
Select * from customers
The node server works fine, but I now want to connect to this from Pentaho and have been trying to figure out how I can do this.
is this possible and if so how ?
If you use the CTools, you can use an AjaxRequestComponent or directly in jquery with $.ajax

I need to know the ids of inserted,updated,deleted in Microsoft Sql Database 2012 with dates

I want to sync my local db with microsoft sql database so I need to know the ids of added records , updated and deleted records after last sync date, I mean I have the last sync date and I need to get all these ids after that date
is microsoft sql server store this information in logs or anywhere ?
This isn't logged anywhere by default unless you either create a mechanism yourself to store the information or perhaps use Change Data Capture as documented here:
Change Data Capture
This allows SQL server to track data that changes in a table and then exposes the changes via functions that you can call to retrieve the data that has changed with each sync.

can not retrieve data from sql server

I can not retrieve data from db in sql server.
I use the c3p0 as the pool,this is the c3p0.properties:
c3p0.user=test
c3p0.password=123456
c3p0.jdbcUrl=jdbc:sqlserver://xxxxxx:1433;databaseName=TIMDB;SelectMethod=cursor
c3p0.driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
c3p0.maxPoolSize=15
c3p0.testConnectionOnCheckin=true
c3p0.idleConnectionTestPeriod=3600
In the sql server,I have create a new user named test,and its default db is TIMDB,the server roles is public,and this is the user mapping:
But when I start the application,I can get nothing.
From the log created by log4j,I can get the sql used to retrieve data,but if I copy the sql to the sql management stutio and create a new query,I can retrieve some data.
I wonder why?
It looks like a permissions problem to me. If the generated SQl runs when you use it in management studio (i.e under your user account) then you know the code is good. What access have you given the user "test" from your post I see "user mapping: enter image description here"? he will need at least db_datareader and possibly more depending on what code is generated.
You could also try logging on to SQL Management studio under your "test" user and see if you can execute the code. That will eliminate the possibility that its something wrong with your application/network.