How to construct URL for Google API with query parameters - rest

I'm trying to construct a URL to request with GET method:
https://dataform.googleapis.com/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:readFile
https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories.workspaces/readFile#query-parameters
what I have but not working:
https://dataform.googleapis.com/v1beta1/{workspace=projects/my-project/locations/europe-west4/repositories/my-repo/workspaces/my-workspace}:readFile
Now I don't know how to put in the query parameter path.
I've tried to add ;path=my_file%2Ejson or ?path=my_file%2Ejson at the end of above URL and path is my_file at root of my-repo
My question is:
Is this even the right way to do this and how to do this correctly?

This is the correct query syntax for setting the path in your case:
https://dataform.googleapis.com/v1beta1/projects/MY_GCP_PROJECT/locations/europe-west4/repositories/REPOSITORY_NAME/workspaces/MY_WORKSPACE:readFile?path=my_file.json
So it works without the curly brackets and "workspace=".

Related

how to handle paths with openapi?

The structure of my node here in the company follow this sequence.
I have the app.js and all request will check my openapi /paths to see if there is a path that match my path in the url.
If there is no match I get a message path is not found.
But I need way to handle any path that isn't list in my openapi /paths instead of putting all path in the list.
for example I have 100 path 10 of them I will put explicit in the openapi paths all other (90) I want to handle without declaring in the in the openapi paths
I would like something like this:
paths:
/v1/client
/v1/product
...
...
/* for the 90 other paths
so when I call
localhost:3000/v1/client works fine
localhost:3000/vi/product works fine
this paths above will the treat for a specific function
localhost:3000/v1/anything doesn't work because isn't explict declared in my openapi paths.
I dont want to declare all other paths in the openapi. I want to forward all these other path to an spefic funtion.
thanks in advance.

SAPUI5 Right List items Path with using keyword

When i try to list that path i am getting an error. What is the right syntax for path in my scenario? How can use like ('USER') keys?
items="{path:'/personel('USER')/issues'}"
also i triend this. (>)
items="{path:'/personel('USER')>/issues'}"

How do I pass xquery through eXist-db's REST api?

I understand how to use Xpath
http://localhost:8080/exist/rest/db/movies?_query=//movie[title=%22Spider-Man%22]/node()
But how to pass an xquery query? I keep reading everywhere that the REST api is for both xpath and xquery but I can't get my query to work. Here is what I'm trying to pass as an example (I've tested this in the xquery sandbox and it works):
for $movie in doc("movies/movies.xml")/movies/movie[year > 2002]
return <movie> { ($movie/title, $movie/year) } </movie>
How do I pass this in a URL? I dont really know where to start so I've tried just pasting the query above as the GET param, similar to the xpath query. So the url I pass is
http://localhost:8080/exist/rest/db/movies/?_query=for%20$movie%20in%20doc(%22movies/movies.xml%22)/movies/movie[year%20%3E%202002]%20return%20%3Cmovie%3E%20{%20($movie/title,%20$movie/year)%20}%20%3C/movie%3E
The page I get back is this
Am I going about this totally the wrong way? "movies" is a collection in my db.
It looks like your query was successfully executed. The <exist:result/> element looks quite correct, but it simply didn't find any movies which fit your filter criteria. It might also be a namespace issue. You should try your query locally to see if it returns something.
Your <script id="tinyhippos-injected"/> element is rather weird, as I did not expect tiny hippos here. However, this seems to be due to some Chrome extension you use.
Also, if your XQuery is a bit longer a URL paramter will not do and the encoding is difficult to read and maintain anyways. You might want to take a look at the eXist documentation about how to submit a POST request with an XQuery.

$this->request->getArgument('group'); not working outside the plugin for breadcrums

I building an TYPO3 extension, withs contains a frond-end plugin. In the fluid template I'm using the following link. This links contains the argument named "group" to send the value "3" to the page.
<f:link.action pageUid="1" pluginName="PluginAds" controller="Ads" arguments="{group: 3}">
In the controller "PluginAds" under "AdsController" it works ok to get the value with the following action:
$this->request->getArgument('group');
But I also want to use the argument "group" for generating the correct breadcrums link. But when I use the same code in a different controller I'm getting the error that the argument does not exists. Can anyone help on this?
Inspect with browser tools how does f:link.action constructs prefixes for params of your plugin, it's i.e.: tx_extkey_pluginsname[myparam]
Within the plugin's actions you can get myparam by
$this->request->getArgument('myparam')
anyway anywhere else you need to get it as normal GET array, so it will be something like:
$pluginsParams = GeneralUtility::_GET('tx_extkey_pluginsname');
$myParam = $pluginsParams['myparam'];
Other thing is that you should always check if:
$this->request->hasArgument('group')
Before trying using it, otherwise it can lead you to null pointer exception.

How to sanitize a $_GET on Typo3 extension?

I have an extension that access a file directory. I use an ajax function to send the path that needs to be access to the controller and in the controller I use a $_GET cause I haven't figure it out how to make it work otherwise.
$image_file_path = $_GET["url_region"];
$d = dir($image_file_path) or die("File not found!");
But of course when you request for something else like ../../.. you can access all other directories.
Could you suggest me a way to sanitize this? Please!
You should provide a cHash as URL parameter and let TYPO3 verify that. This way you can be sure the URL has been generated by TYPO3 itself and thus is valid.
You should consider using t3lib_div::_GET() which unescapes the parameters regardless what php.ini magic_quotes says.
You easily could use a regex to catch all "../" - values of the parameter. The other way could be, that the available paths being defined in a array, or something else, to check up the right access.