I've just figured out how to complete a Nutch crawl via the REST api for the 2.3 version of Nutch. You can see my post here. So after running the crawl, I go to MongoVue to check out the results and there is no "status" or "baseUrl" fields, along with others. Now if I do a normal crawl through cygwin, I get all fields. Is there some parameter I'm missing from the POST request to UPDATEDB call?
Here is the last call I make for Updatedb.
{
"args":{
"crawlId":"crawl-01",
"batch":"1428526896161-4430"
},
"confId":"default",
"crawlId":"crawl-01",
"type":"UPDATEDB"
}
I figured it out. The timestamp used in the GenerateJob step was wrong. It needed to be in a particular format and my code wasn't supporting it. Found a work around.
Related
I am using the following query:
https://api.github.com/search/repositories?q=mysql&created:%3C2009-04-11&order=asc
and see the same results as:
https://api.github.com/search/repositories?q=mysql&created:%3E=2013-04-11&order=asc
Looks the created is not taking into effect.
can you please help me if I am missing anything in the query?
At document of REST API v3, parameters are added using +. So how about the following modification?
From :
https://api.github.com/search/repositories?q=mysql&created:<2009-04-11&order=asc
https://api.github.com/search/repositories?q=mysql&created:>=2013-04-11&order=asc
To :
https://api.github.com/search/repositories?q=mysql+created:<2009-04-11&order=asc
https://api.github.com/search/repositories?q=mysql+created:>=2013-04-11&order=asc
If I misunderstand your question, I'm sorry.
Edit :
When you want to retrieve the data using curl, please use as follows. In this case, please enclose the URL using double quotations. The URL in this sample is from your comments.
curl "https://api.github.com/search/repositories?q=python+created:%3E2009-04-11&page=1"
or
curl "https://api.github.com/search/repositories?q=python+created:>2009-04-11&page=1"
I'm using Grails 2.3.2 working on a REST API using the built in Grails REST support. I'm having trouble getting rid of the "class" element in the JSON response. Based on a tutorial by Bobby Warner, I have found adding the following to the resources.groovy file:
meterRenderer(JsonRenderer, Meter) {
excludes = ['class']
}
This works fine for show, but for the index controller function, I'm responding with a list of Meters. In this, the "class" doesn't go away. What does it take to get rid of this in the list response?
Edit: To clarify, I am looking for a way to leverage the Content Negotiation feature of Grails new respond functionality without locking myself down to render as JSON implementions.
I guess if you switch to using GSON (github) instead of JSON then you need not worry about that particular exclusion.
That is driven by a config setting provided by the plugin as grails.converters.gson.domain.include.class (default is false).
nickdos' SO link had the answer. I added the following to my BootStrap.groovy:
grails.converters.JSON.registerObjectMarshaller(Meter) {
return it.properties.findAll {k,v -> k != 'class'}
}
And the respond call results in no "class" item. Oddly enough, I lost the "id" item in the process, but I'll save that for another SO question. :)
I have downloaded swagger ui and experimenting it locally. It works fine in scenarios like "path", "body" , and "query" . But most of my use cases use rest comments.
i.e /resourcePath/;tags
URI to retrieve the tags of a specific resource.
When I try this the the UI gets jumbled when adding the semi colon and malformed the sorted UI and cannot go beyond this.
So is this a known limitation ? Is there a workaround to accomplish this target ?
Appreciate any input to this..
Swagger is expecting you to specify path params in curly-brackets like {tags} and query params as comma-delimited, such as id=1,2,3,4. Some frameworks use semi-colons as delimiters but swagger likes commas.
Can you describe more what you're looking to do, with a more concrete example? Per design, comments on the api belong in the description and notes fields for operations, please see swagger-core wiki for details.
The Swagger codegen project has a validator which can be used to verify that your spec is properly formatted.
I am trying to use HTTP to POST a file to an outside API from within a grails service. I've installed the rest plugin and I'm using code like the following:
def theFile = new File("/tmp/blah.txt")
def postBody = [myFile: theFile, foo:'bar']
withHttp(uri: "http://picard:8080/breeze/project/acceptFile") {
def html = post(body: postBody, requestContentType: URLENC)
}
The post works, however, the 'myFile' param appears to be a string rather than an actual file. I have not had any success trying to google for things like "how to post a file in grails" since most of the results end up dealing with handling an uploaded file from a form.
I think I'm using the right requestContentType, but I might have missed something in the documentation.
POSTing a file is not as simple as what you have included in your question (sadly). Also, it depends on what the API you are calling is expecting, e.g. some API expect files as base64 encoded text, while others accept them as mime-multipart.
Since you are using the rest plugin, as far as I can recall it uses the Apache HttpClient, I think this link should provide enough info to get you started (assuming you are dealing with mime-multipart). It shouldn't be too hard to change it around to work with your API and perhaps make it a bit 'groovy-ier'
I am just trying to get the current absolute url of the page. Here is the snippet of the code
my $url_str = "BEFORE";
$sel->storeLocation("url_str");
$sel->comment(URL is $url);
Send command: storeLocation|url_str|
Got result : OK
Comment : URL is BEFORE
It does not seem to work. I tried with $url_str, \$url_str as arguments to the storeLocation but in vain. Please help on what exactly am I missing here
The Perl API uses the more Perlish 'get_' as a prefix instead of the Selenium standard of 'store'. Also the Perl API uses underscores instead of camel case.
# returns the current url
$sel->get_location()
Also see:
The WWW::Selenium docs on CPAN
The Test::WWW::Selenium docs on CPAN
The official Selenium docs