Remove collection through API in Fauna - faunadb

Header says it all. Is there a way to delete/remove/drop a collection in FaunaDB through the API?
I've tried to look through all of the listed functions but I hope I've missed it.

Sure. Delete($ref) where $ref is something like Collection("foo") will delete all the documents in the named collection.
Full docs for Delete are here.
There is also an example provided, as eskwayrd points out.

Related

Use category name in Sitefinity blog URL

I followed the instructions here on establishing a new provider and generating custom URLs, and it works as expected. There doesn't seem to be a clear reference for what parameters can be utilized in the settings as the example given is very basic.
I want to use the category name of the post in the URL. I tried:
/[Category]/[UrlName]
but what I got in the frontend was:
http://localhost:60327/my-page/Telerik.OpenAccess.TrackedList%601[System.Guid]/my-post-name
I also tried
/[Category.Title]/[UrlName]
which just threw errors.
Anyone know how to do this, or better yet, a good reference for the parameters?
I don't think this is possible since the Category property is actually a collection (TrackedList).
In theory you would need one of the collection items, let's say the first one, and your URL expression would be /[Category[0].Title]/[UrlName], but this is currently not supported by the expression parser.
Also, the idea of making the URL dependent on a complex (related) field is not a good idea. If someone deletes that category, they will break all your blog post URLs.
I would suggest you to create a custom text field for the blog post item (ex: CategoryUrl) and then you should be able to set the URL format to /[CategoryUrl]/[UrlName]. Make sure CategoryUrl field is required.

API Blueprint - How to perform a simple UPDATE

I have went through the documentation of Apiary but did not find out how to create a blue print to update a resource.
What I am trying to achieve here is a simple scenario such as having a list of users, being able to list them, retrieve a single user by id, define different attributes for that user, modify one-n attributes of that user (updating that user), and delete that user.
Could someone redirect me to some clear documentation or to a stackoverflow question that I have missed during my research and that would help me achieve this?
I think you have to use PUT or PATCH method for update resource. Look into this blog post here are some examples.

REST API design for running a transformation on a resource

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

Is there a good methods to find user's all tags with acts-as-taggable-on?

I use acts-as-taggable-on https://github.com/mbleigh/acts-as-taggable-on for tagging user's post, I want to find one user's all post' all tags and list them, Is there a high performance method ?
You need to add acts_as_tagger to the User model
refer to https://github.com/mbleigh/acts-as-taggable-on#tag-ownership
then you can use the methods provided. If you're starting from a blank db, this should work but may need to run through some re-assigning loop to have the tagger association work.
Assuming your data is correct, you will then be able to do:
#some_user.owned_taggings
#some_user.owned_tags
Hope this helps

Flickr API - Photos Search, excluding tags: Am I doing this wrong?

So, I'm trying to pull all photos of a specific user's account via the flickr.photos.search method, but I want to exclude photos with a particular tag. The related documentation page states that "You can exclude results that match a term by prepending it with a - character." ... Well, I tried implementing that option but what get in return is only one photo (even though there are several photos with the tag in question) and that result remains the same whether that specific photo has the tag in question or not AND whether or not I use the "-" option to exclude that tag rather than include it. I also tried the text method with the same exact result. Here's my REST call:
http://api.flickr.com/services/rest/?&method=flickr.photos.search&api_key='.$api_key.'&user_id='.$user_id.'&tag_mode=any&tags=-blog&extras=url_o,url_t&format=json
And here is the page where I'm trying to get this all working:
http://corazonbrew.com/temp/
Anyone know what is going on here?
It seems the answer in the Flickr discussion board I linked to earlier is proving true. In order to use the exclusion option, there has to also be at least one other, non-excluded tag. Well, that is just not good enough for me.
A couple of friends tell me this is a longstanding bug that will not be fixed anytime soon, if ever. But those friends also kindly reminded me of my n00bishness- this whole time I thought I needed to affect the feed to get the desired output. I totally was not realizing I could just use some good ol' PHP if statements to weed out what I don't want.