I am using inbuilt rest end point in Marklogic that allow me to call modules in stored in module database in Marklogic.
http://localhost:8000/LATEST/invoke?data-urlencode=module=/modules/module.xqy&database=databasename&data-urlencode=vars='{"word1":"hello","word2":"world"}'
Does it also provide any option to call direct function present within lib module?
Using vars option it allows us to pass external parameter to the invoking modules. It seems that vars option only allow to pass primitive values to external parameter to invoking module.
But how we can use this vars option to pass XML data to invoking module so that it can be access through external variable defined within module.
Any suggestion would be appreciated.
Note : I am using postman for testing of rest API.
Many thanks.
Since your goal is to get to a library function, consider creating a REST extension instead of using /invoke with a main module. A REST extension can implement your choice of HTTP verbs and accept input in whatever for you'd like. The extension can then convert those inputs to function parameters and call the function.
For more information about REST extensions, see Extending the REST API, which includes an example XQuery extension.
Related
I'd like any https request to MY_CUSTOM_DOMAIN/functions/** to go to firebase functions.
I'm aware of the below solution:
Use custom domain for firebase function http calls
https://firebase.google.com/docs/hosting/functions#create_an_http_function_to_your_hosting_site
My understanding is this requires adding every single function to this list though. It would make my firebase.json file pretty long and probably I'll forget to update it on future functions.
You can refer to this documentation to use the wildcards and avoid repeating URL paths. Seems like you have to mention every function you are using for routing.
There is one workaround, As you are concerned about firebase.json. You can define an index function which determines the specific path by using req.path and calls other Cloud Functions to handle the respective request.
Also have a look at this thread1 & thread2
I'd like to include an embedded graphql processor in my .net app.
I want to execute GraphQL functions via a method and I don't need the server or an endpoint.
Basically an internal GraphQL processor. I'll define the resolvers and the schema and then run queries via a method call. Is this possible?
You may take a look NReco.GraphQL (which is based on GraphQL.Net but has an additional features, like aggregation, filter, ect.). You can compose in code schema, query (or query object) and call it just in-code.
I wonder how you can append a second api to an already registered api in Azure api management via an ARM deploy?
If I use the same value for the name property in my Microsoft.ApiManagement/service/apis resource. It overwrites the whole api instead of appending it. I don't find a property in the arm reference docs to specify I want to append the api instead of overwriting it: https://learn.microsoft.com/en-us/azure/templates/microsoft.apimanagement/2019-01-01/service/apis
I want to accomplish the same result via arm, like I am able todo via the Azure portal import menu
This is also described in the docs: https://learn.microsoft.com/en-us/azure/api-management/add-api-manually#append-other-apis
That is easily not possible at the moment. "Append" logic is implemented in UI, but it does rely only on publicly available ARM calls. You could inspect calls it makes to ARM to append one API to another and try to reproduce it "by hand".
I receive API via swagger format with dynamic variables:
"/tour/{tour_id}/": {
// ...
},
Swagger-importer extension imports these variables like this:
It looks like environmental variable and Paw creates random value for request, but looks like it's unable to create environment variable for this.
I plan to receive API from backend developers via swagger export files and don't want to change requests because they will be overwritten with every import. It would be great to import API as is from backend and just edit environment variables.
The Swagger / Open API Initiative does not specify that parameters sharing the same name are the same parameter, and it makes sense as the constraints on each parameter could be different based on the operation being done. Therefore, Paw cannot merge parameters together into an environment variable.
Swagger does define a root level field named parameters, which can be used to share parameters between requests, and the Swagger Importer could move these into environment variables, but that's as far as it can go, considering the swagger spec.
This would be nice to have, but that feature is not on the roadmap for next month, although it will probably be introduced later on (I created an issue on github to remember it)
I've got, I think, a relatively simple question. I'm wondering in Meteor, especially when I'm defining server-side functions that I want the client to be able to call, when do I use a method vs a normal function? Why can't I just use a global function in my Meteor server code instead of defining a Meteor Method?
thanks!
Functions defined only the server are only accessible to server code (even if defined globally). So for example, if you had a function defined in server/util.js it would not be available to the client.
You could, however, define a function that was global to both the server and the client by placing it outside of the server and client directories, e.g. in lib.
Generally, you would choose to create a method over a function when you want a side effect which should only be produced on the server. Examples:
you need to sign a URL and keep the key only on the server
you need to perform a database operation that can only be done on the server (due to limitations of minimongo)
Important note - method calls from the client are asynchronous (you need to provide a callback function to know the result of the method), so that may also factor into your decision.