Fetching client id and client secret of a Salesforce connected app from backend - automation

Is there a way to fetch the client id and client secret of a Salesforce connected app from backend (through any apex code or anything) without using the UI? I am actually working on Salesforce API automation so need to fetch these in runtime and store in string variables to use them in the API request headers.

You could use Metadata API to retrieve details of connected app(s). Sample XML you'd get is at the bottom of https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_connectedapp.htm
I don't think there's a pure Apex solution, you might have some luck with this Apex wrapper for the callouts: https://github.com/financialforcedev/apex-mdapi
If you're after automation you might want to look into creating connected apps on the fly? https://help.salesforce.com/articleView?id=remoteaccess_oidc_dynamic_client_reg_flow.htm&type=5

Related

Do I need access tokens when creating a Shopify app and using its API keys?

I am creating a connection between a clients Shopify store and an order management system called Extenda NYCE. For this I have created a custom app and given it all necessary accesses via the Admin API congifurator.
When I've configured the app and installed it in Shopify backend I use the API keys to get access to it via the order management system, but I get an error. Due to poor UX I can't see the whole error message but basically what I am doing is I try to make an article import by using the API keys.
Now I've tried to find a solution to this by reading about using API keys and I seem always to end up in information regarding access tokens and the need of implementing access to these so that the third-party system can get access to the API.
I'm totally lost so I figured why not look it up with StackOverflow. Have you had similar experiences? To me it just seems way too advanced if I need to write scripts to generate access tokens so that the API can have access to the shop data. Isn't the API interface developed NOT to have the need of writing code in Shopify?

Cannot get data from Basic API to Azure Data Factory

I have a Basic API connection from Recurly. I want to use that API to get data about my Data Base using Azure Data Factory. I created ls_RestAPI, created ds_RestAPI and created 1 pippeline to proceed to get the data. But there are some problems. My API has Basic Auth as username and no password (Postman Image), header is Accept and Authorization.
When I start connecting it using ADF, it throws an error due to incorrect syntax. I have provided pictures for you to understand easily.
I tried to remove or edit Accept and Authorization but it still doesn't work:
How can I reconfigure it properly to be able to get data from the above API?
My aim is that after running, Rest API can call all Next Page of API in 1 run. So I use:
"paginationRules": {
"AbsoluteUrl": "$.next"
but now I have the problem that I can't connect to the API.
ADF Rest connector only expects a Json response. This is mentioned as a warning in one of your screenshots.
As a result, this is overriding what you have entered for Accept Header.
Could you try firing this API call from some other service like Logic apps?

Can API gateway access database directly?

Can API gateway access to database directly?
We have a client we need to integrated our product using REST API. We already provide some kind of REST API, but it is not suitable for their usage, thus they asked us to provide specific REST API for their usage.
So, we decided to implement API Gateway pattern to call our API and perform some response transformation. And here is the issue. Our API does not provide all the data needed by this customer in responses, but the data are stored in database. And I am wondering if it is OK to talk to database directly from API Gateway or we should create a specific REST API and call that instead.
If you have a kind of database handler that handles access and visibilty concerns it should be okay, but for further purposes you should think about providing database access via REST too, with a user authentication
There is no direct connection between API gateway and database instead you can connect your DB with lambda and use lambda as an integrator

Should I use an API or direct database access?

I have a database with all my employee's information. Should I build an API or should I give direct access to the database?
The API could be built with Node.js and be a REST API. The database access could be given with different database users / different permission sets.
I'm confused because when I query an API, I usually get JSON data back which is awesome. So I wonder if only I can build an API that contains all the data I want and when I query it, I can have my employee's info back in JSON format.
There are reasons to use a REST API. For example you'll have a app, that will be available to the public, you might don't want to write your SQL queries directly in your code, as well as the credentials to connect to your server. Anyone with the knowledge could decompile your app and see your code and have access to the credentials to you database server. The good approach here is to write an REST API to handle the flow of data between your app and database, since REST API should be designed to be accessed publicly, you'll only have to pass in the data, or just call the api you need, you don't need the servers credentials to connect. If you are going local, then you could use the database approach of yours. Since your app will be used only by your clients.

How to apply cron jobs to Api methods that requires authntication?

Hello frinds presently i am doing manually authentication and getting user tweets and post form various api like instagram,tweeter,youtube but it requires authentication .
Now i want to automate the process and wish to run cron so i can fetch data every hour with authentication.
I know it is possible by passing access token in url methods but no idea how to do it.
first of all you need to have those access tokens. I'll explain the YouTube API and will also write other API's links. Process is similar in almost every API first you get the token then you pass it in URL.
YouTube API :
Here is a document about YouTube API which will help you create your own access key. After creating it just pass the key in URL with key=YOUR_API_KEY. You can retrieve datas from these links they might also give you an idea about how to use the api key : Videos , Channels (There are examples in the documents for JAVA, PHP and Python ). If you are using PHP you can use this curl function for authentication and retrieving datas.