What is right way to create multi purpose rest end point? - rest

I want to create a rest end point but I am not sure what is right way. For example I want to expose endpoint to create account but there are multiple account type like:
Normal account with property name, description, and current balance
Credit Card account with property name, description, current balance, grace period, billing date and current outstanding. Now the confusion is, Shall I create two endpoint for each of account type? or Shall I create single end point with all the property.

Shall I create two endpoint for each of account type? or Shall I create single end point with all the property.
How would you do it on a web site?
You might have a single create-account form; you collect the information that you need from the visitor, the form is submitted to the server, and the server looks at the form details to determine what kind of account to create. Create the account, and send back a response to the browser announcing where the web page describing the account is. And that's fine.
You might do the same thing with multiple forms; through a series of links you guide the visitor to the form that best fits their circumstances, and then the remaining work is the same as above - the form is submitted, the server looks at the form details to determine the account to create, the account is created, the server sends back a response to the browser announcing where the web page describing the account is. And that's also fine.
You could do the same thing with multiple forms, but have each of the forms submit using a different target URI; you could even have each form submitted to a different host! Again, the actions taken by the host receiving the form are the same - do the work, return the result announcing where the new web page is.
Thw browser doesn't care, it's just collecting form inputs using standardized form processing rules, and then submit the result using the meta data in the form.
You'll want different code responsible for creating each of the different kinds of accounts (the "separation of concerns" idea), but it doesn't much matter if the routing of the request to that code is done purely mechanically (because you are using different URI) or "by hand".

Related

REST api to allow multiple users edit the same form at the same time

I'm looking to make something similar to google docs where everyone can update the form (with multiple input fields) at the same time using REST api, the form data will be stored in database, is it possible?
I can have the form to send an update request whenever user make a change, but I still can't quite figure out what the logic to retrieve data/update form field content and resolve conflict when users are editing the same field.
Best way to use SignalR for realtime communication as well as pushing the updates to other users belonging to the similar group (may be call it as users of a same form). SignalR will provide all the underline infrastructure in place.

Is there a way to use Shopify MetaFields to tag customers with data?

I've been trying to find a way to store a piece of data relative to a customer in my store. Ideally I was hoping to be able to create a Metafield that would store a single numerical value and be retrievable by the customer's id or email.
Any thoughts or suggestions would be really appreciated. Ideally I'd like to be able to handle everything in the liquid layer by editing the html and css of the store directly. A custom app with API integration is another option but less desirable as it doesn't seem necessary and would appear to be a lot more work.
EDIT: Tried piggybacking the order (thinking orders are unique to users) but it doesn't appear that the order object is created until the checkout is complete so that isn't really useful since I want to be able to attribute the user to a session click that led them to the store.
Thanks,
Alex
You will want to use an App. First, off, that is the only way for you to alter any objects in Shopify. Secondly, you can easily store simple things like counter values on the Customer resource using metafields. Third, anything you do with metafields on the Customer would be easily visible to the customer, since you can expose those metafields using Liquid. Fourth, if you choose to use JS you must use the App Proxy pattern. Shopify will then send your JS XHR payload to your App endpoint in a secure fashion.
So your needs and how to do are not new, they are old skool in Shopify terms and very straightforward to implement.

Is it possible to manipulate the database through mail in oracle apex?

I was having the similar problem as mentioned in the below link, Select and Display the table in oracle APEX mail body. I followed the mentioned steps and it worked!! .
Now, I just want to extend the same question and wanted to know, Is it possible to manipulate the the database through click on the button in the mail?
If I crate the html Button APPROVE, It should be able to manipulate database table.
Suppose, APPROVE performs delete operation: delete ename from emp where dno=10.
VERSION : ORACLE APEX 4.2
If you are sending an HTML email to a user and you want that user to interact with the system from the email, you could generate an HTML form that submits to a particular URL (some APEX page with some set of parameters) that actually implements the DELETE.
Assuming that the client email application would allow the user to submit a form, which would generally be a security issue and would probably not be possible from some clients, you'd probably have security issues to worry about on the server side. I'd assume, for example, that you don't want to allow any random person that works out the URL to call to be able to delete whatever row you want from your system. You probably want to require that someone is logged in before you'd allow them to delete a row. And you probably want to make sure that they have permission to delete that particular row.
It's certainly possible that you could work around both the client and the server side permission issues by doing something like creating a unique token that expires after a short period of time and gets passed in with the form to verify that the user has permission to delete that particular row. But by the time you're building that sort of infrastructure or sending users to a login page, you're probably better off just creating links in your email that point to a page in your application and letting users go there to request the actual delete. That's going to work more reliably than a form that submits a request and it will probably involve less work for you.

How do I view the invoices for a specific account through a URL in Microsoft Dynamics CRM?

I'm trying to add an iframe into the form for viewing accounts that will display all the invoices that are connected to that account. I've read this MSDN page about accessing specific forms through a URL, which I can achieve, but copying the URL generated into an iframe I have created on my form produces an error message.
I'd like to know whether what I'm trying to accomplish is possible and if so, how I should format the URL so that only the invoices connected to the user account being opened will be displayed. I'll add more details later if I can.
I think what you actually want to do is add a sub-grid. This is different from an iFrame, an iFrame generally contains web resources, or links to pages on the web. A sub-grid specifically exists to show related records - e.g. to show the left hand relationships links on the body of the form.
I think this article should show you what to do.
Edit - based on Jacks comment:
So Crm can't handle this situation quite so easily with out of the box features. But you do have a couple of options. I dont think any of these are perfect solutions, so I'll let you choose.
A sub-grid effectively just runs some FetchXml, you can change this FetchXml with JavaScript, so you could alter the view to return the records not directly related. Green Bible has an example, though this doesnt look like its supported.
Use a report in an iFrame.
Use a plugin, I havnt done this myself, but a colleague told me it was possible to stick a plugin on the retrieve message and basically change the query or results which is used by the view.
Create a second relationship between the invoice and the account. Then whenever you link an invoice to an account, also populate this new relationship (a workflow will do) with the account, and whenever an invoice linked to a contact is created, populate the new relationship with the parent account of the contact (again a workflow will do). Then just base your sub-grid on this new relationship. This approach isnt the cleanest but its probably the quickest and easiest to implement.

Form Journey Tracking using google analytics

Is there anyway, using google analytics, to track a user's journey/selections through a long form so I can see where they drop off?
I've created a 'contact us' form which starts with drop down menu which requires the user to make a choice i.e. apply for job, apply for funding etc. and then each option requires the user to fill out a form, which is completed over serval steps.
Is there a way to track a user's individual form choices from their initial selection on the Contact Us page through to the form being submitted? That way I could see where in the form journey the users are dropping off.
If the form is a multi-page form, then you can use Goal Funnel tracking to obtain reports which will help you understand how users fail to complete the form:
http://www.google.co.uk/support/googleanalytics/bin/answer.py?hl=en-uk&answer=55515
The Regular Expression matching in Goal Funnels is quite useful if you have different paths or different form URLs for the same goal. You could also track multiple page views per actual URL, if you wanted to monitor the users who move onto a different step on a single URL.
If you need to analyze how users complete a particular form, you could use Event Tracking to record when each field is completed. You will need to carefully think about how you wish to use Event Tracking to obtain the information you require.
http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
But Google Analytics is not good at tracking individual users' behavior. You may wish to take a look at ClickTale if you want to do more advanced form usage analysis.