Uploading to the content box

5 views
Skip to first unread message

John Goodwin

unread,
Dec 10, 2009, 5:18:56 AM12/10/09
to n2-dev
Hi,

I'm trying to upload some javascript to my content box. I do this as
follows:

curl -v -d @sparql.js --digest -u "****:****" -H content-
type:application/javascript http://api.talis.com/stores/ordnance-survey/items/

* About to connect() to api.talis.com port 80 (#0)
* Trying 82.147.9.14... connected
* Connected to api.talis.com (82.147.9.14) port 80 (#0)
* Server auth using Digest with user 'ordnancesurvey'
> POST /stores/ordnance-survey/items HTTP/1.1
> User-Agent: curl/7.19.5 (i586-pc-mingw32msvc) libcurl/7.19.5 zlib/1.2.3
> Host: api.talis.com
> Accept: */*
> content-type:application/javascript
> Content-Length: 0
>
< HTTP/1.1 401 Unauthorized
< Date: Thu, 10 Dec 2009 10:16:44 GMT
< WWW-Authenticate: Digest realm="bigfoot", domain="null",
nonce="3jQXeCUBAAD/tZ
5FZCit5YUqz+9n5III", algorithm=MD5, qop="auth"
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 12
< Connection: close

any idea what is going wrong? The username and password I supply are
correct, and in the past I have successfully loaded RDF to the store.

thanks

John (confused of Southampton)

John Goodwin

unread,
Dec 10, 2009, 5:24:45 AM12/10/09
to n2-dev
Hmm...it seems the Javascript has been loaded here:

http://api.talis.com/stores/ordnance-survey/items/fb2f5edf-c9ea-4af9-a3cc-4fd848def702

but why can I not point to it as

http://api.talis.com/stores/ordnance-survey/items/sparql.js ??

John (potentially stupid of Southampton)

On Dec 10, 10:18 am, John Goodwin <goth...@btopenworld.com> wrote:
> Hi,
>
> I'm trying to upload some javascript to my content box. I do this as
> follows:
>
> curl -v -d @sparql.js --digest -u "****:****" -H content-
> type:application/javascripthttp://api.talis.com/stores/ordnance-survey/items/

Keith Alexander

unread,
Dec 10, 2009, 5:26:54 AM12/10/09
to n2-...@googlegroups.com
Hi John,

You should be able to PUT it at
http://api.talis.com/stores/ordnance-survey/items/sparql.js
eg

curl -x PUT -v -d @sparql.js --digest -u "****:****" -H content-
type:application/javascript
http://api.talis.com/stores/ordnance-survey/items/sparql.js


Keith
> --
> ----
> n-squared : Talis Platform Developers
> Mailing List : http://groups.google.com/group/n2-dev
> Wiki : http://n2.talis.com

Malcolm Landon

unread,
Dec 10, 2009, 5:29:14 AM12/10/09
to n2-...@googlegroups.com
Hi Jon

The platform is using Digest authentication. Curl makes 2 requests when you post the file into the store. The first one recieves a 401 unauthorised and is given the nonce needed to make the request using digest authentication.

Here is the output of me doing the same. You can see curl receives a 401 unauthorised, but automatically uses the none to make a second request which succeeds.

Malcolm


ml@sookie:/tmp/n2-dev$ curl -v -d @sparql.js --digest -u "****:****" -H content-type:application/javascript http://api.talis.com/stores/malcyl-dev2/items

* About to connect() to api.talis.com port 80 (#0)
*   Trying 82.147.9.14... connected
* Connected to api.talis.com (82.147.9.14) port 80 (#0)
* Server auth using Digest with user '****'
> POST /stores/malcyl-dev2/items HTTP/1.1
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10

> Host: api.talis.com
> Accept: */*
> content-type:application/javascript
> Content-Length: 0
>
< HTTP/1.1 401 Unauthorized
< Date: Thu, 10 Dec 2009 10:23:21 GMT
< WWW-Authenticate: Digest realm="bigfoot", domain="null", nonce="****", algorithm=MD5, qop="auth"

< Content-Type: text/plain; charset=UTF-8
< Content-Length: 12
< Connection: close
<
* Closing connection #0
* Issue another request to this URL: 'http://api.talis.com/stores/malcyl-dev2/items'

* About to connect() to api.talis.com port 80 (#0)
*   Trying 82.147.9.14... connected
* Connected to api.talis.com (82.147.9.14) port 80 (#0)
* Server auth using Digest with user '****'
> POST /stores/malcyl-dev2/items HTTP/1.1
> Authorization: Digest username="su", realm="bigfoot", nonce="****", uri="/stores/malcyl-dev2/items", cnonce="****", nc=00000001, qop="auth", response="****", algorithm="MD5"
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10

> Host: api.talis.com
> Accept: */*
> content-type:application/javascript
> Content-Length: 4
>
< HTTP/1.1 201 Created
< Date: Thu, 10 Dec 2009 10:23:22 GMT
< Server: Bigfoot/30.1258.56780
< Cache-Control: max-age=7200, must-revalidate
< Location: http://api.talis.com/stores/malcyl-dev2/items/cda095ba-9ed0-49e2-8d17-9e5e5a0df214
< Content-Length: 0
< Connection: close
< Content-Type: text/plain; charset=UTF-8
<




2009/12/10 John Goodwin <got...@btopenworld.com>
--
----
n-squared : Talis Platform Developers
Mailing List : http://groups.google.com/group/n2-dev
Wiki : http://n2.talis.com



--
--
email - mal...@landonsonline.me.uk
web   - malcolm.landonsonline.me.uk

John Goodwin

unread,
Dec 10, 2009, 5:33:09 AM12/10/09
to n2-dev


On Dec 10, 10:26 am, Keith Alexander <k.j.w.alexan...@gmail.com>
wrote:
> Hi John,
>
> You should be able to PUT it athttp://api.talis.com/stores/ordnance-survey/items/sparql.js
> eg
>
> curl -x PUT -v -d @sparql.js --digest -u "****:****" -H content-
> type:application/javascripthttp://api.talis.com/stores/ordnance-survey/items/sparql.js
>
You mean:

curl -X PUT -v -d @sparql.js --digest -u "****:****" -H content-
type:application/javascript http://api.talis.com/stores/ordnance-survey/items/sparql.js

:)

But thanks - that's done the job...

cheers

John

John Goodwin

unread,
Dec 10, 2009, 5:37:18 AM12/10/09
to n2-dev

On Dec 10, 10:29 am, Malcolm Landon <malcolm.lan...@gmail.com> wrote:
> Hi Jon
>
> The platform is using Digest authentication. Curl makes 2 requests when you
> post the file into the store. The first one recieves a 401 unauthorised and
> is given the nonce needed to make the request using digest authentication.
>
> Here is the output of me doing the same. You can see curl receives a 401
> unauthorised, but automatically uses the none to make a second request which
> succeeds.

Thanks Malcolm - all working now. Clearly need to read up a bit on
CURL.

cheers

John
Reply all
Reply to author
Forward
0 new messages