Yii 1.1.16 brought getPatch($paramName, $defaultValue=null) and getIsPatchRequest() to life, but is there a way to loop through all PATCH parameters, without knowing their names? If a user wants to modify his tag line, but nothing else, how am I supposed to know that he wants to change user_tag_line?
Calling getPatch() gives
Missing argument 1 for CHttpRequest::getPatch().
I've solved it by using
CJSON::decode(file_get_contents('php://input'));
Is this safe, should this be used? Are there other ways of going about this?
Related
I would like to see if anyone else already had this problem. I'm really struggling to find out an solution for that, so that's why I've decided to call for help.
So, i have this Ownbackup API endpoint:
Ownbackup API
Here's the link for the API documentation: https://cdn2.hubspot.net/hubfs/2571574/api%20document-1.html#tag/Enhanced-Sandbox-Seeding/paths/~1api~1v1~1sbs~1templates~1{template_id}~1seed/post
But for me it wasn't too helpful.
The point in here is that my organization has hundreds of validations rules. And I would like to know if there is any parameter that this API understands in order to disable ALL validation rules, without the need of passing the name of each one of the file names in the request body.
Keep in mind that the format for this request is multipart/form-data.
Thank you all!
So, I've reached out for Owbackup support and they told me that i can actually use "disable_validation_rules" set to true, so this way the All validation rules get disabled and the triggers not, also it does not require me to specify which validations rules should be disabled.
I'm letting this answer in here, in order someone else comes across this problem!
Cheers!
I need to use the table in from this wiki page https://en.wikipedia.org/wiki/List_of_most_visited_museums to make a database in python (though the latter part is irrelevant atm). I have to use the API (can't scrape) to access it. Right now I'm trying the API's documentation https://www.mediawiki.org/wiki/API:Parsing_wikitext#Example_1:_Parse_content_of_a_page Example #2 from this page is exactly what I want to do, but it's returning an error, and even running the original code in my notebook it also returns an error. Can anyone tell me how to either alter that code so it runs, or direct me to another way to do the same thing? Thanks.
This fetches the content you're after: https://en.wikipedia.org/w/api.php?action=parse&page=List%20of%20most%20visited%20museums&prop=wikitext§ion=2&format=json
If the example isn't working in your notebook, the problem probably lies with the rest of your code and not with the API call.
I wrote a simple tool to decode JWT tokens and I'd like to use it in a similar way as the Interactive Regex Evaluator.
Is there a way to either automatically hide a query (e.g., via the Util class) or to even register it to something like Ctrl+Shift+F2?
Unfortunately that functionality doesn't exist.
You'll notice when using the Interactive Regex Evaluator it's opening the sample of the same name but doing extra work to hide the query panel. Looking at LinqPads code using it's own ILSpy, there's a method called LINQPad.UI.MainForm.miRegex_Click and it's calling the method LINQPad.UI.QueryControl.ToggleFullPaneResults which does that functionality but unfortunately the method is internal.
If you'd like to suggest the feature head over to the LinqPad forums over at http://forum.linqpad.net/ and make the suggestion. Joseph is good at getting back to people.
Is there any way to make the standart PrestaShop's Layered filters module to use URL parameters instead of anchors (the part after hash)?
I ment that I want the layered filter generate and accept the URLs like this (or maybe somehow diferrent, but the key is to use parameters and not to use hashes):
my-example-shop.ru/some-category/?color=red&size=xl
instead of this:
my-example-shop.ru/some-category#/color-red/size-xl
The reason is that the most of advertisment systems could add some parameters to the URL, but they usuaul add it directly to the end of the URL, and dont trying to analyze url structure and insert parameters to the right place.
So, as far as i see, the obvious solution is to avoid using hashes in url, using just query parameters, and to use history.pushState to change URL without refreshing whole page...
It seems obvious, usable, but I cant find any ready-to-use solution that do this such way, and I cant find even information about how does someone did it..
So the questions are:
is there any ready-to-use solution?
is there any described way to reach this by myself?
Thanks in advance.
UPD
All I found by myself for now is that such URLs could be accepted:
my-example-shop.ru/some-category/color-red/size-xl
my-example-shop.ru/some-category?selected_filters=/color-red/size-xl
BUT any filters changing causes using hashes again (afaik, hashed filters values overrides values passed via selected_filters parameter, so subsequent navigation just ignores selected_filters). In other words - I just can clear the entry URL, BUT I couldnt make URLs to be clean for subsequent navigation.
The change is very large.
You should create the override classes/Dispatcher.php
For filters instead you should edit the file: blocklayered/blocklayered.php
find function: getSelectedFilters()
Inside are two foreach, you should withdraw from the url "featured" fields that you need and compile the new array "$selected_filters"
So I know this is crazy from a security standpoint, but let's say I have a posts resource at /posts/ and I'd like an admin to be able to trigger a transformation on the collection (in this case, a simple data migration).
How should I design the URL for something like that? It's basically a remote procedure: "take all the posts, modify them, and save them", which is why it is hard to shoehorn onto REST.
I ended up just doing POST /posts/name-of-transform. It's going to be hacky either way :(
So what you want is to update a collection right?
I think what you're looking for is the http PATCH method. It will acte pretty much like your POST method but instead of creating the ressources it will update them.
You can find more about the PATCH method at this address : https://restful-api-design.readthedocs.org/en/latest/methods.html