I'm trying to access jenkins (v2.177) API using curl. For instance, I try to get the lastbuild number as follows :
curl -v -u user:pass http://myjenkins:port/job/myjob/lastBuild/api/json
Insted of giving me a json, I get a "302 Found" with Content-Length egal to zero ! :
`* Trying 11.90.1.9...
* TCP_NODELAY set
* Connected to 11.90.1.9 (11.90.1.9) port 8484 (#0)
* Server auth using Basic with user 'user7'
> GET /job/myjob/lastBuild HTTP/1.1
> Host: 11.90.1.9:8484
> Authorization: Basic dGVzdGl.../blc2Y...
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Tue, 14 May 2019 13:01:12 GMT
< X-Content-Type-Options: nosniff
< Location: http://11.90.1.9:8484/job/myjob/
< Content-Length: 0
< Server: Jetty(9.4.z-SNAPSHOT)
<
* Connection #0 to host 11.90.1.9 left intact`
Any idea why I don't get the JSON ?
Okay ...
I had to specify the branch like that :
curl -v -u user:pass http://myjenkins:port/job/myjob/job/mybranch/lastBuild/api/json
Now it works
I'm trying to get Slim to run on my Windows 7 system.
So far I've gotten everything installed with Composer but when I run a very simple program, the output is not as intended.
Below is my code:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
use Slim\App;
use Slim\Http\Request;
use Slim\Http\Response;
require '../vendor/autoload.php';
$app = new App;
$app->get('/', function (Request $in, Response $out, $args) {
return $out->write("xxxxx");
});
$app->run();
I am expecting output "xxxxx", instead i get "x".
This means I loose 4 characters somewhere.
Running PHP 5.5.12
The encoding is UTF-8 (not BOM)
When i run
"curl -v http://localhost:8080/"
I get
D:\wamp\www\slim_test\src\public>curl -v http://localhost:8080/
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.46.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Host: localhost:8080
< Connection: close
< X-Powered-By: PHP/5.5.12
< Content-Type: text/html; charset=UTF-8
< Content-Length: 5
<
x* Closing connection 0
I'd appreciate your help.
EDIT
Once i append these lines of code to the end of the file, the response is correct.
$response = $app->run(true); //Silent mode, wont send the response
$response = $response->withoutHeader("Content-Length"); //Remove the Content-Length
$app->respond($response); //Now we send the response
I cannot figure out why.....?
This issue has been solved as I found a very stupid mistake.
I had 2 blank spaces before the <?php tag.
I am trying to send a POST request to a site using Hyper 0.9. The request works with curl:
curl https://api.particle.io/v1/devices/secret/set_light -d args=0 -d access_token=secret
and Python:
import requests
r = requests.post("https://api.particle.io/v1/devices/secret/set_light",
data={"access_token": "secret", "args": "0"})
but my Rust implementation doesn't seem to go through, always yielding 400.
use hyper::client::Client;
let addr = "https://api.particle.io/v1/devices/secret/set_light";
let body = "access_token=secret&args=0";
let mut res = client.post(addr)
.body(body)
.send()
.unwrap();
It is greatly beneficial to be aware of various tools for debugging HTTP problems like this. In this case, I used nc to start a dumb server so I could see the headers the HTTP client is sending (nc -l 5000). I modified the cURL and Rust examples to point to 127.0.0.1:5000 and this was the output:
cURL:
POST /v1/devices/secret/set_light HTTP/1.1
Host: 127.0.0.1:5000
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 26
Content-Type: application/x-www-form-urlencoded
args=0&access_token=secret
Hyper:
POST /v1/devices/secret/set_light HTTP/1.1
Host: 127.0.0.1:5000
Content-Length: 26
access_token=secret&args=0
I don't have an account at particle.io to test with, but I'm guessing you need that Content-Type header. Setting a User-Agent would be good etiquette and the Accept header is really more for your benefit, so you might as well set them too.
I'm a newbie to Neo4j, which is at the moment my main candidate of all the graph databases out there. I'm writing a thesis about integrating a database to a smart city, and Neo4j is one of the best candidates for this purpose, if not the best.
However, I'm unable to get Neo4j's SPARQL plugin working. I'm a newbie also to Maven, but I was able to download the plugin from GitHub and compile it - however, I had to skip the tests to be able to compile it. Anyway, 'build success.'
I followed the instructions
http://neo4j-contrib.github.io/sparql-plugin/
and I suppose that I was able to insert the example quads (example 1) to my database:
curl -X POST -H Content-Type:application/json -H Accept:application/json --data-binary #sampledata.txt -v http:// l o c a l h o s t :7474/db/data/ext/SPARQLPlugin/graphdb/insert_quad
Response:
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 7474 (#0)
> POST /db/data/ext/SPARQLPlugin/graphdb/insert_quad HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:7474
> Content-Type:application/json
> Accept:application/json
> Content-Length: 130
>
* upload completely sent off: 130 out of 130 bytes
< HTTP/1.1 204 No Content
< Access-Control-Allow-Origin: *
* Server Jetty(9.0.5.v20130815) is not blacklisted
< Server: Jetty(9.0.5.v20130815)
<
* Connection #0 to host localhost left intact
However, I cannot find that quad in my database. I suppose that a query 'MATCH (n) RETURN n LIMIT 100' would show them, right? Anyway, I only find one node with one property, 'value: urn:com.tinkerpop.blueprints.pgm.oupls.sail:namespaces.' When I try querying (example 2):
curl -X POST -H Content-Type:application/json -H Accept:application/json --data-binary #sampledata.txt -v http:// l o c a l h o s t :7474/db/data/ext/SPARQLPlugin/graphdb/execute_sparql
Response:
Hostname was NOT found in DNS cache
Trying 127.0.0.1...
Connected to localhost (127.0.0.1) port 7474 (#0)
POST /db/data/ext/SPARQLPlugin/graphdb/execute_sparql HTTP/1.1
User-Agent: curl/7.35.0
Host: localhost:7474
Content-Type:application/json
Accept:application/json
Content-Length: 74
upload completely sent off: 74 out of 74 bytes < HTTP/1.1 500 Server Error < Content-Type: application/json; charset=UTF-8 <
Access-Control-Allow-Origin: * < Content-Length: 3274
Server Jetty(9.0.5.v20130815) is not blacklisted < Server: Jetty(9.0.5.v20130815) < { "message" :
"org.openrdf.query.algebra.Var.setConstant(Z)V", "exception" :
"NoSuchMethodError", "fullname" : "java.lang.NoSuchMethodError",
"stacktrace" : [
"org.openrdf.query.parser.sparql.TupleExprBuilder.createConstVar(TupleExprBuilder.java:340)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.mapValueExprToVar(TupleExprBuilder.java:271)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1512)",
"org.openrdf.query.parser.sparql.ast.ASTPathSequence.jjtAccept(ASTPathSequence.java:20)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1323)",
"org.openrdf.query.parser.sparql.ast.ASTPathAlternative.jjtAccept(ASTPathAlternative.java:18)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1875)",
"org.openrdf.query.parser.sparql.ast.ASTPropertyListPath.jjtAccept(ASTPropertyListPath.java:18)",
"org.openrdf.query.parser.sparql.ast.SimpleNode.childrenAccept(SimpleNode.java:157)",
"org.openrdf.query.parser.sparql.ASTVisitorBase.visit(ASTVisitorBase.java:979)",
"org.openrdf.query.parser.sparql.ast.ASTTriplesSameSubjectPath.jjtAccept(ASTTriplesSameSubjectPath.java:18)",
"org.openrdf.query.parser.sparql.ast.SimpleNode.childrenAccept(SimpleNode.java:157)",
"org.openrdf.query.parser.sparql.ASTVisitorBase.visit(ASTVisitorBase.java:421)",
"org.openrdf.query.parser.sparql.ast.ASTBasicGraphPattern.jjtAccept(ASTBasicGraphPattern.java:19)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1144)",
"org.openrdf.query.parser.sparql.ast.ASTGraphPatternGroup.jjtAccept(ASTGraphPatternGroup.java:19)",
"org.openrdf.query.parser.sparql.ast.SimpleNode.childrenAccept(SimpleNode.java:157)",
"org.openrdf.query.parser.sparql.ASTVisitorBase.visit(ASTVisitorBase.java:1021)",
"org.openrdf.query.parser.sparql.ast.ASTWhereClause.jjtAccept(ASTWhereClause.java:19)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:389)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:228)",
"org.openrdf.query.parser.sparql.ast.ASTSelectQuery.jjtAccept(ASTSelectQuery.java:19)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:378)",
"org.openrdf.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:228)",
"org.openrdf.query.parser.sparql.ast.ASTQueryContainer.jjtAccept(ASTQueryContainer.java:21)",
"org.openrdf.query.parser.sparql.SPARQLParser.buildQueryModel(SPARQLParser.java:210)",
"org.openrdf.query.parser.sparql.SPARQLParser.parseQuery(SPARQLParser.java:164)",
"org.neo4j.server.plugin.sparql.SPARQLPlugin.executeSPARQL(SPARQLPlugin.java:68)",
"java.lang.reflect.Method.invoke(Method.java:606)",
"org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)",
"org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:159)",
"org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:312)",
"org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)",
"java.lang.reflect.Method.invoke(Method.java:606)",
"org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)",
"java.lang.Thread.run(Thread.java:744)" ]
Connection #0 to host localhost left intact
I'm wondering what could be causing this kind of behavior. I have tried SPARQL plugin with many configurations, according to all the instructions I have found, but the plugin just refuses to work.
By the way, I'm wondering is it suitable for production use. Can someone comment on this?
Perhaps there are more ways than one to get RDF working in Neo4j? As I'm a newbie to Neo4j, I'm, of course, interested in solutions that are somewhat easy to install and tailor. Well, first and foremost, they should really work in production use.
Neo4j is working otherwise just great! REST API works just fine, but I would like to compare it with the SPARQL endpoint if possible.
I've uploaded a (pgp) file via the documents API, and changed its
visibility to public. However, I'm unable to download it publicly
using the contents link for that file.
Here are the relevant bits of the xml for the meta-data for the file in
question.
$ curl -H "GData-Version: 3.0" -H "Authorization: Bearer ..." https://docs.google.com/feeds/default/private/full
...
<content type="application/pgp-encrypted" src="https://doc-0c-c0-docs.googleusercontent.com/docs/securesc/tkl8gnmcm9fhm6fec3160bcgajgf0i18/opa6m1tmj5cufpvrj89bv4dt0q6696a4/1336514400000/04627947781497054983/04627947781497054983/0B_-KWHz80dDXZ2dYdEZ0dGw3akE?h=16653014193614665626&e=download&gd=true"/>
...
<gd:feedLink rel="http://schemas.google.com/acl/2007#accessControlList" href="https://docs.google.com/feeds/default/private/full/file%3A0B_-KWHz80dDXZ2dYdEZ0dGw3akE/acl"/>
$ curl -H "GData-Version: 3.0" -H "Authorization: Bearer ..." https://docs.google.com/feeds/default/private/full/file%3A0B_-KWHz80dDXZ2dYdEZ0dGw3akE/acl
...
<entry gd:etag="W/"DUcNRns4eCt7ImA9WhVVFUw."">
<id>https://docs.google.com/feeds/id/file%3A0B_-KWHz80dDXZ2dYdEZ0dGw3akE/acl/default</id>
...
<gAcl:role value="reader"/>
<gAcl:scope type="default"/>
...
The role/scope returned for the file in question is reader/default, indicating
it is public. (It also shows up with public shared access in the web UI.)
However, accessing
the src attribute in the content element results in:
$ curl --verbose 'https://doc-0c-c0-docs.googleusercontent.com/docs/securesc/tkl8gnmcm9fhm6fec3160bcgajgf0i18/opa6m1tmj5cufpvrj89bv4dt0q6696a4/1336514400000/04627947781497054983/04627947781497054983/0B_-KWHz80dDXZ2dYdEZ0dGw3akE?h=16653014193614665626&e=download&gd=true'
< HTTP/1.1 401 Unauthorized
< Server: HTTP Upload Server Built on May 7 2012 18:16:42 (1336439802)
< WWW-Authenticate: GoogleLogin realm="http://www.google.com/accounts"
< Date: Tue, 08 May 2012 22:48:37 GMT
< Expires: Tue, 08 May 2012 22:48:37 GMT
< Cache-Control: private, max-age=0
< Content-Length: 0
< Content-Type: text/html
It seems like you are trying to publish a document: https://developers.google.com/google-apps/documents-list/#publishing_documents_by_publishing_a_single_revision
Once you publish it, the link with rel set to "http://schemas.google.com/docs/2007#publish" will point to the published document on the web.