How do i set dynamic default value of a rest data source in oracle apex? - api

I have just started learning oracle apex.
I imported an external API into oracle apex(https://localhost/report/?dateFrom=2022-09-30&dateTo=2022-10-01) . This API has two parameters dateFrom and dateTo. I want to dynamically set the datefrom parameter to 5 days ago and dateTo to today in default value. How can I do this?

One option is to define the parameter value for the component, which is using the REST data source. If that is, for instance, a report, you can configure within the Parameters Node in Page Designer. In the tree on the left hand side, click the node for your parameter, and then (in the Attributes pane on the right, choose Expression or Function Body, and enter the expression to compu For a REST Synchronization (download data to local table), you would configure the same as a Synchronization Step.
These options will configure the dynamic value at the component level (the component which uses the REST Data Source).
However, your question reads like you're after a default to be applied to all components using that REST Data Source. The Expression or Function Body options are not available at the REST Source level. I'd see two approaches:
Define an application item (APP_REST_DATEFROM), and a Application Computation to set the value for this item. In the REST Source, then simply use &APP_REST_DATEFROM. as the value for your parameter. At the component level, it's important to switch the parameter value to REST Source Default.
Another option allows you to completely take these parameters out of the REST Source configuration, but implies some PL/SQL coding effort: You could author a REST Source Plug-In, where the Plug-In code implements custom handling for all aspects of the HTTP requests being made for the REST Data Source. That typically includes pagination, but can include all parameter handling (HTTP Header, URL Parameters, etc). An example for such a Plug-In is here: https://github.com/oracle/apex/tree/22.1/plugins/rest-source/fixed-page-size
I hope this helps.

Related

How to define REST API with to Parameter

I am currently working on a REST API for a project. In the process I should search for events. I would like to make an endpoint for searching events in a period. That is, specify two parameters with from - to.
For the search you normally take a GET operation. My question is now it makes sense to specify two parameters in the path or should I rather fall back to a POST operation for something like that.
Example for the path /Events{From}{To}
Is this even feasible with multiple parameters?
If you are not making a change on the resource, you should use GET operation.
More detailed explanation:
If you were writing a plain old RPC API call, they could technically interchangeable as long as the processing server side were no different between both calls. However, in order for the call to be RESTful, calling the endpoint via the GET method should have a distinct functionality (which is to get resource(s)) from the POST method (which is to create new resources).
GET request with multiple parameters: /events?param1=value1&param2=value2
GET request with an array as parameter: /events?param=value1,value2,value3

How to do right rest api update?

I am developing rest api update method for user profile resource user/profile. I am disappointed what http method should i use. Update contains some required attributes so it more PUT request, where client need to fill all attributes. But how it can extend attributes in future. If i will decide to add new attribute then it will automatically clear because client is not implement it yet.
But what if this new attribute has default value or is set by another route?
Can i use PUT with not stricting number of attributes and use old data if new isn't come in request. Or how it can be done normally?
HTTP is an application whose application domain is the transfer of documents over a network -- Webber, 2011.
PUT is the appropriate method to use when "saving" a new version of a document onto a web server.
how it can extend attributes in future.
You design your schemas to be forward and backward compatible; in practice, what this means is that you can add new optional elements with reasonable default values. When you need to add a new required element, you change the name of the schema.
You'll find prior art in this topic by searching XML literature for must ignore.
You understand correctly: PUT is for complete replacement, so values that you don't include would be lost.
Instead, use the PATCH method, which is for making partial updates. You can update only the properties you include values for.

Add Validation in Aurelia dynamically

Is there a way to add Validation to a property on my VM "dynamically" (i.e. sometime after I register the initial rules on the VM)?
Currently, I'm registering the rules in the constructor of the VM, then a little while later, after the user has entered a bunch of data, I need to show a new field (using if.bind) and want to add validation depending on the result of a web api call..
Wondering if there's an API for this that I've missed?
You can achieve it without dynamically adding rule but instead you can use satisfiesRule and when, see it here in section Conditional Validation. satisfiesRule will only evaluated if the property that attached to it is already pass.
when will only evaluated the rule if the condition is true.
Additional link.
If you're using bootstrap, you can find this useful.

WF4 Argument as Property

My scenario is the following:
I have a workflow (lets call it customActivity1) that do the basic actions for my system. I also have another workflow (customActivity2) that uses customActivity1 and do higher level actions. When I call customActivity1, I must pass on a few parameters, like Boolean or String values. I want to show some of these parameters as a checkbox or combobox (so the developer of customActivity2 can pass on only valid values) and found out that I can do that by setting the argument as PROPERTY (instead of In).
By doing a research, I also found out that you can’t directly use this argument in expressions, so I keep getting errors on my customActivity1.
That said and knowing that I need to narrow what the designer can pass on, how could I do that without using an activity designer or where could I find an answer?
I also attached two pictures, one of what I need and the other of the error I’m getting.
Thanks in advance.
The reason an InArgument only shows you a text field instead of a checkbox is because they are expressions not literal values. There is still type checking though, if you enter the value 1 you get the error message that an integer cannot be converted into a boolean.
You cannot do this. You can only bind to InArguments.
If you bind an InArgument and look at the xaml, you'll see something like this:
<p1:MyActivity MyInArgument="[BoundValue]" ...
The Workflow Runtime knows how to handle these. It doesn't know how to handle binding POCO properties.
If you want to model data flow but want to have a different user experience in the property grid I recommed using arguments (as they convey data flow semantics) and customizing the property grid for those arguments. There is a sample that demonstrates how to do this in the WF4 samples (sample readme available at http://msdn.microsoft.com/en-us/library/ee834515.aspx)

Create request with SOAP ui

Is it possible to create soap ui request with data ? right now I know how to create new request which gives you template what you should send to your webservice (which is read from you wsdl), is there a way so your requests fills with data based on type(ex: String,Integer, Date) from wsdl, from soap ui or any other test tool ? thank you
In Soap UI 4.5.1 there's an option under preferences that once set will auto populate new requests with dummy data that is type safe instead of the default '?'.
File->Preferences->WSDL Settings-> Tick option "Sample Values" and hit OK.
You can enter data directly into the XML request generated by SoapUI, you can write scripts to populate data, or if you have the Pro version, it gives you a GUI form, based on the request, where you can simply type the data. i.e. it makes a data-entry screen for you.
The pro version can also pull data from databases, generate data from a string list, etc.. for example, I recently needed to send several thousand SOAP payloads with dummy data for firstname/lastname, etc.. So I made up two string lists, one with first names of past and present NFL quaterbacks, one with last names. I had the data generator in SoapUI (Pro) randomly select a string from each, and submitted it in a stress test for 1000 iterations. The results were very useful, yet very amusing, giving names like Drew Montana.
Yes, you can use SOAPUI to complete this task. you can fetch your data from several sources like Excel,plain csv file,Database liks DB2,POSTGRES. You can also write your groovy scripts to control the flow.Various things you can do to achieve this...