Connecting to MongoDB to be used in UIPath - mongodb

I am trying to connect to MongoDB so I can use it in UIPath but there are no APIs available other than DB administrative APIs. I want to manipulate the actual data in the data table. How can I do this, other than creating a robot that manipulates the table directly.

If you are using MongoDB Atlas, which is Cloud based, does not have ANY CRUD APIs. In MongoDB Server side, the CRUD APIs are deprecated so for sure they will not have it in the cloud version.
Unfortunately, you will need to go through a third party to connect to MongoDB. Luckily there are a few out there. The one I like to use is PrestoAPI.
Got to the PrestoAPI Website: https://prestoapi.com/
Click on get started for free
Fill out the user data, select if this is for personal or business and then select Free
There will be a confirmation email sent
Confirm your email, (you may have to resend the confirmation link) and then sign in
Once you log in, you will see this:
Click on Connect to A Database
Click again to get this pop up
All information needed is in the connection string we got from MongoDB
Driver is MongoDB
We will use the database Sample_airbnb from the database sample
Click on test
Once it says connection successful, we can move on
FYI, sometimes PrestoAPI will drop the “+srv” from the beginning of the connection string. Ensure that this part is correct or recopy again from MongoDB
You will get this result
Go back to the dashboard and click on Create a project
You should see the AirBNB name
Click on Submit
Next, select “Create your first endpoint”
It will give you a list to go through. Ensure you pick the name of the Endpoint (you only get 10 of them)
Select the database, the component (Table) and the table you want to read
For now, everything else can stay as default but you can always go back and tweak them
Once complete, click Submit. You now have a list of usable CRUD APIs for your MongoDB Atlas
You can now use these end points and call them in Node.js, UIPath or wherever a regular REST API can be called

You can use Invoke code activity. Here is the detailed step-by-step answer

Related

Create New user Apache Atlas

There is an Apache Atlas server. The user connects using ldap technology. Users are adding the atlas-simple-authz-policy.json config file.json and specify its role in the application. We are faced with the following situation, until you create a user on the server itself (useradd nickname), the user will not receive full access within his role. I.e., in fact, the user will be able to log in to the application, perform some kind of search that will display the result, but it is already impossible to view the contents of the fragments found.

How to send Session ID parameter out FROM Moodle?

I need to send user-specific values to an external system from Moodle. How can I force Moodle to send the session ID (or user ID, activity ID, etc.) to this third-party system? All of the articles out there seem to be written for calling into Moodle but this is not what I need to do.
Important:
I cannot alter the Moodle installation. The solution must only involve editing content. This means I cannot author a new plugin or alter any of the Moodle source code.
Edit:
I do have direct access to the Moodle database from a separate external API. The goal was to use this connection to validate the incoming parameters. However, I still need to be able to construct a parameterized URL to call out the external app. That app would then be able to validate the supplied values against the database. If the session ID is not available then I would need the values regarding the page, user, module, etc. to be sent via the parameterized URL.
For the session id do you mean the current user session? There is a session key stored in $_SESSION['USER']->sesskey but its not really useful data. It expires when a user logs out.
$_SESSION is server side, so you would need to use PHP code which isn't allowed in content for security reasons.
Have you got access to the database? You could pull user id and activity id from there. Otherwise you will need to use an API or a plugin.
EDIT: There is a URL activity that you could use to send data externally. But that would require the user to click the link.
Data includes user and course ids.
https://docs.moodle.org/311/en/URL_resource_settings
I can't think of any solution to send data externally without writing some PHP code or adding a plugin.
You can add javascript to every page via Site administration > Appearance > Additional HTML but the session variables aren't available without PHP.
https://docs.moodle.org/311/en/Header_and_footer

Shopify import csv products

I would like to know if there is a default feature for importing products export files in json/xml/csv format and if this can be called daily with a cron or something automatically.
Thanks,
Tibi
You are free to create a private App that has scope permissions to write_products, write_inventory and read_locations. With that, you can establish a script that can parse your json/xml/csv and update inventory. That script can be scheduled to run as often as you need. Shopify is an ideal platform for the use of scripting to accomplish many manual tasks.
I agree with David. You need to create a custom App in your store and submit your data to a script(you can use PHP) triggered by CRON hosted on a server which will create a record using Product API.
Step 1: Go to Apps tab in admin section of your store. Scroll down and click on Manage private apps, create an App here to generate API keys and password.
Step 2: Create and host(on a secured server) a script that will use API keys generated in previous step to create new product record using https://help.shopify.com/en/api/reference/products/product#create
Step 3: Fetch your data in any format and send this data in JSON format to your Shopify store using API. A new product record will be created in your store.
Note: You can test this API by using credential created in Step 1 on Postmen tool you can refer https://help.shopify.com/en/api/reference/products/product#create. You will have to hit Example URL generated in Private app from Step 1.

couchDB / pouchDB / IONIC best practice

I want to create an app with IONIC to manage buildings. A user can hold multiple buildings. Each building has rooms. Each rooms has logs. Each user is a member of a cooperation.
For many years I've used LAMP. Now moving to mobile and made some IONIC apps. With 2 apps I've used sqlLite as datastore on the mobile device.
But now I've read up on couchDB and pouchDB and really like the concept and the sync option. So now I'm looking into this to use as my datastore (on the mobile and also on the backend).
Now I've got 2 major questions/concerns:
1) Authentication
In my LAMP situation, I usually have an SESSION (table which holds the sessions strings and userID) and an USERS table.
When the user logs in, the user is lookup in the USERS table, and a session string is created and saved with the userID.
Now each time a request is made to the server (for example update data), the session string is also supplied and matched to the SESSION table and retrieve the correct user. From that point on, I can validate if the post is valid and the data also belongs to the correct user.
Back to couchDB, I know there is a cookie management in couchDB (http://guide.couchdb.org/editions/1/en/security.html).
So here I can validate if an user exists and validate the credentials. Now the app can send requests with a cookie.
2) Fetch/Update the right data
In my LAMP situation, I always knew which data belongs to which user. And the back end always checks if this is correct.
In my couchDB I want to create database and each document is an user with all the data.
So now here comes the problem. I can validate an user in couchDB, put there's no way to validate the data (at least as far I know of) that it belongs to the right user.
My goal is that the mobile device syncs the document to the couchDB server.
3) Database structure
At first I wanted to create a database per user. But this is not scalable. Also an user is an member of a cooperation. I also need to generate reports per cooperation/user.
So now I was thinking to create a database per cooperation. But now the problem is, when a user login, I need to know wich database to connect to lookup the user data.
Now I want to use 1 database and each document is an user and holds al data (buildings/logs).
Has anybody got some other suggestions/resources on this approach?
You can try couchdb in combination with superlogin:
SuperLogin is a full-featured NodeJS/Express user authentication solution for APIs and Single Page Apps (SPA) using CouchDB or Cloudant.
github
Tutorial

Mongodb - how to add database user through spring application

I want to implement database authentication in mongodb.
In order to do that, I found out that I need to first create an admin user and then create separate users for each of my database through mongodb client shell (manually or using a javascript file).
I was wondering if it is possible to add user to the individual databases from the spring application itself but did not get any useful pointers to do this. Is it that this approach is wrong because if this possible the application will always be able to access the database because it itself is creating the user, but external access will still be blocked.
Please let me know how this can be achieved or if it is an incorrect approach.
After you add a normal user via the MongoShell, you can then connect via your application and create either normal users, or read only users.
Note that a normal user can also add users, so the users your application adds may need to be down as read only users depending on your use case and needs.
In the MongoShell, adding a read only user can be done via
use myAppDB
db.addUser("JohnSmith", "CheddarCheese", true)