Thread: POST input to dataselect/1/query returning 400 ?

Started: 2013-05-02 22:56:48
Last activity: 2013-05-02 22:56:48
Topics: Web Services
Carl.Sandland@ga.gov.au
2013-05-02 22:56:48
Yes, that fixed my problem using wget and led me to solve my underlying python problem.

thanks for your help.

Because it might be interesting, my old python bulkdataselect code:

with open(input_file_name) as f:
post_data = f.read()
post_data = dict(selection=selection_data)
request_obj = urllib2.Request(url=url_server, data=urllib.urlencode(post_data))

This did not work when switching endpoints, this did fine:

with open(input_file_name) as f:
post_data = f.read()
request_obj = urllib2.Request(url=url_server, data=post_data)

Cheers,
Carl

-----Original Message-----
From: webservices-bounces<at>iris.washington.edu [webservices-bounces<at>iris.washington.edu] On Behalf Of webservices-request<at>iris.washington.edu
Sent: Thursday, 2 May 2013 3:42 PM
To: webservices<at>iris.washington.edu
Subject: webservices Digest, Vol 30, Issue 1

Send webservices mailing list submissions to
webservices<at>iris.washington.edu

To subscribe or unsubscribe via the World Wide Web, visit
http://www.iris.washington.edu/mailman/listinfo/webservices
or, via email, send a message with subject or body 'help' to
webservices-request<at>iris.washington.edu

You can reach the person managing the list at
webservices-owner<at>iris.washington.edu

When replying, please edit your Subject line so it is more specific than "Re: Contents of webservices digest..."


Today's Topics:

1. Re: abbreviations in query params (Chad Trabant)
2. POST input to dataselect/1/query returning 400 ?
[SEC=UNCLASSIFIED] (Carl.Sandland<at>ga.gov.au)
3. Re: POST input to dataselect/1/query returning 400 ?
[SEC=UNCLASSIFIED] (Chad Trabant)


----------------------------------------------------------------------

Message: 1
Date: Tue, 30 Apr 2013 17:03:41 -0700
From: Chad Trabant <chad<at>iris.washington.edu>
Subject: Re: [webservices] abbreviations in query params
To: IRIS Web Services List <webservices<at>iris.washington.edu>
Message-ID: <2AFA7ABB-C2C6-4EE4-BAA0-287877829789<at>iris.washington.edu>
Content-Type: text/plain; charset="iso-8859-1"


Hi Philip,

We will shortly fix the main pages of the services to consistently denote when the abbreviated versions of parameters are supported. The IRIS implementations support all the abbreviations allowed in the spec. In general if something is in the spec and supported by our service it should be considered supported and not an "artifact" just because the documentation is minority incomplete.

A link to the specification has been added to each of the FDSN web services, thanks.

Chad

On Apr 30, 2013, at 8:33 AM, Philip Crotwell <crotwell<at>seis.sc.edu> wrote:

Hi

The main page for the fdsn dataselect and station web services say that you should use network, station, location and channel. But the examples sometimes use abbreviations like "sta". This example on the main fdsn station page uses "network" but also "sta".

http://service.iris.edu/fdsnws/station/1/query?starttime=2013-01-01&ne
twork=IU&sta=ANMO&level=channel&nodata=404

Another point of confusion is that the docs for the fdsn event services allow minlat instead of minlatitude, but the station docs seems to say latitude must be spelled out in full.

The spec at http://www.fdsn.org/webservices/FDSN-WS-Specifications-1.0.pdf allows these abbreviations, so I am guessing they are allowed for all services. Can you clarify what abbreviations are allowed and update the web pages to reflect this? I would rather form and send shorter urls, but don't want to do that if things like "sta" are artifacts of the implementation and might cease to work in the future.

It would also be really nice if the fdsn web service pages had links to the actual FDSN web service spec. Since you are trying to implement that, people might as well refer to it.

thanks
Philip
_______________________________________________
webservices mailing list
webservices<at>iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/webservices

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iris.washington.edu/pipermail/webservices/attachments/20130430/d1ec628f/attachment-0001.htm

------------------------------

Message: 2
Date: Thu, 2 May 2013 15:02:57 +1000
From: Carl.Sandland<at>ga.gov.au
Subject: [webservices] POST input to dataselect/1/query returning 400
? [SEC=UNCLASSIFIED]
To: webservices<at>iris.washington.edu
Message-ID:
<64596720D115484A9F1C2DC2D4CB0021990E624587<at>EXCCR01.agso.gov.au>
Content-Type: text/plain; charset="us-ascii"

Hello,

I'm moving my code over to the new FSDN endpoints and am having trouble with the bulkdataselect replacement, dataselect:

Here is an example input:
IC BJT 00 BHE 2005-01-01T00:00:00 2005-01-01T00:10:00 IC BJT 00 BHN 2005-01-01T00:00:00 2005-01-01T00:10:00 IC BJT 00 BHZ 2005-01-01T00:00:00 2005-01-01T00:10:00

Here is my wget command:
$ wget --debug --post-data foo.in http://service.iris.edu/fdsnws/dataselect/1/query

And here is the result:
----------------------- snip
Setting --post-data (postdata) to foo.in DEBUG output created by Wget 1.11.4 Red Hat modified on linux-gnu.

--2013-05-02 14:39:17-- http://service.iris.edu/fdsnws/dataselect/1/query
Resolving proxy.ga.gov.au... 10.7.64.209 Caching proxy.ga.gov.au => 10.7.64.209 Connecting to proxy.ga.gov.au|10.7.64.209|:8080... connected.
Created socket 3.
Releasing 0x000000000db41ba0 (new refcount 1).

---request begin---
POST http://service.iris.edu/fdsnws/dataselect/1/query HTTP/1.0
User-Agent: Wget/1.11.4 Red Hat modified
Accept: */*
Host: service.iris.edu
Content-Type: application/x-www-form-urlencoded
Content-Length: 6

---request end---
[POST data: foo.in]
Proxy request sent, awaiting response...
---response begin---
HTTP/1.1 400 Bad Request
Via: 1.1 PROXY3
Connection: close
Proxy-Connection: close
Date: Thu, 02 May 2013 04:39:18 GMT
Content-Type: text/plain
Server: Apache-Coyote/1.1
Access-Control-Allow-Origin: *
Vary: Accept-Encoding

---response end---
400 Bad Request
Closed fd 3
2013-05-02 14:39:18 ERROR 400: Bad Request.
------------------ end snip

Any help would be greatly appreciated: hopefully it's a simple user error...

Cheers,

Carl Sandland
Software Consultant | Nuclear Monitoring Project Minerals and Natural Hazards Division | GEOSCIENCE AUSTRALIA ____________________________________________________________
Phone: +61 2 6249 5800 Fax: +61 2 6249 9999
Email: Carl.Sandland<at>ga.gov.au<Carl.Sandland<at>ga.gov.au> Web: www.ga.gov.auhttp://www.ga.gov.au/
Cnr Jerrabomberra Avenue and Hindmarsh Drive Symonston ACT GPO Box 378 Canberra ACT 2601 Australia Applying geoscience to Australia's most important challenges

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.
-------------------------------------------------------------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iris.washington.edu/pipermail/webservices/attachments/20130502/d07f6147/attachment-0001.htm

------------------------------

Message: 3
Date: Wed, 1 May 2013 22:41:29 -0700
From: Chad Trabant <chad<at>iris.washington.edu>
Subject: Re: [webservices] POST input to dataselect/1/query returning
400 ? [SEC=UNCLASSIFIED]
To: IRIS Web Services List <webservices<at>iris.washington.edu>
Message-ID: <8A495374-3363-4E37-8FBC-92D951B844A6<at>iris.washington.edu>
Content-Type: text/plain; charset="windows-1252"


Hi Carl,

For your wget command, instead of the --post-data option try the --post-file option. This worked for me:

wget --debug --post-file foo.in http://service.iris.edu/fdsnws/dataselect/1/query

cheers,
Chad

On May 1, 2013, at 10:02 PM, Carl.Sandland<at>ga.gov.au wrote:

Hello,

I?m moving my code over to the new FSDN endpoints and am having trouble with the bulkdataselect replacement, dataselect:

Here is an example input:
IC BJT 00 BHE 2005-01-01T00:00:00 2005-01-01T00:10:00 IC BJT 00 BHN
2005-01-01T00:00:00 2005-01-01T00:10:00 IC BJT 00 BHZ
2005-01-01T00:00:00 2005-01-01T00:10:00

Here is my wget command:
$ wget --debug --post-data
foo.inhttp://service.iris.edu/fdsnws/dataselect/1/query

And here is the result:
----------------------- snip
Setting --post-data (postdata) to foo.in DEBUG output created by Wget
1.11.4 Red Hat modified on linux-gnu.

--2013-05-02 14:39:17--
http://service.iris.edu/fdsnws/dataselect/1/query
Resolving proxy.ga.gov.au... 10.7.64.209 Caching proxy.ga.gov.au =>
10.7.64.209 Connecting to proxy.ga.gov.au|10.7.64.209|:8080...
connected.
Created socket 3.
Releasing 0x000000000db41ba0 (new refcount 1).

---request begin---
POST http://service.iris.edu/fdsnws/dataselect/1/queryHTTP/1.0
User-Agent: Wget/1.11.4 Red Hat modified
Accept: */*
Host: service.iris.edu
Content-Type: application/x-www-form-urlencoded
Content-Length: 6

---request end---
[POST data: foo.in]
Proxy request sent, awaiting response...
---response begin---
HTTP/1.1 400 Bad Request
Via: 1.1 PROXY3
Connection: close
Proxy-Connection: close
Date: Thu, 02 May 2013 04:39:18 GMT
Content-Type: text/plain
Server: Apache-Coyote/1.1
Access-Control-Allow-Origin: *
Vary: Accept-Encoding

---response end---
400 Bad Request
Closed fd 3
2013-05-02 14:39:18 ERROR 400: Bad Request.
------------------ end snip

Any help would be greatly appreciated: hopefully it?s a simple user error?

Cheers,

Carl Sandland
Software Consultant | Nuclear Monitoring Project Minerals and
Natural Hazards Division | GEOSCIENCE AUSTRALIA
____________________________________________________________
Phone: +61 2 6249 5800 Fax: +61 2 6249 9999
Email: Carl.Sandland<at>ga.gov.au Web: www.ga.gov.au
Cnr Jerrabomberra Avenue and Hindmarsh Drive Symonston ACT GPO Box 378
Canberra ACT 2601 Australia Applying geoscience to Australia?s most
important challenges Geoscience Australia Disclaimer: This e-mail (and
files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.
----------------------------------------------------------------------
---------------------------------------------------

_______________________________________________
webservices mailing list
webservices<at>iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/webservices

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iris.washington.edu/pipermail/webservices/attachments/20130501/b7f617c4/attachment.htm

------------------------------

_______________________________________________
webservices mailing list
webservices<at>iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/webservices


End of webservices Digest, Vol 30, Issue 1
******************************************

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.
-------------------------------------------------------------------------------------------------------------------------



10:52:59 v.01697673