This archive is retained to ensure existing URLs remain functional. It will not contain any emails sent to this mailing list after July 1, 2024. For all messages, including those sent before and after this date, please visit the new location of the archive at https://mailman.ripe.net/archives/list/ripe-atlas@ripe.net/
[atlas] Problems trying to add a probe to a measurement
- Previous message (by thread): [atlas] Problems trying to add a probe to a measurement
- Next message (by thread): [atlas] Behind the scenes changes to measurement creation
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Colin Strutt
colin at interisle.net
Fri Apr 7 20:42:06 CEST 2017
As a result of some debugging with significant help from Viktor Naumov, we've been able to solve the problem. In fact there are two problems: 1. The example in the ripe_atlas_api_V2_manual.pdf is wrong 2. The example shows using curl under UNIX; Windows requires a completely different approach to make the curl command word. The example in the manual (page 84) shows JSON that it not accepted by atlas.ripe.net - the outer "layer" of JSON needs to be removed. So rather than '{"probes":[{"action":"add","requested":1,"type":"country","value":"NL"}]}' you need to use '{"action":"add","requested":1,"type":"country","value":"NL"}' And, while the example works on UNIX, it does not work, as shown, on Windows. It took a while to work out why. It appears that, in UNIX the single quote is used to escape the contents in between, so what gets sent to the HTTP server is just {"action":"add","requested":1,"type":"country","value":"NL"} But this "convention" does not work on Windows. Instead, the single quotes should be removed, and then *every* double-quote has to be escaped, with a backslash character, in order for the correct JSON to be sent to the HTTP server. This is the corrected version of the example in the API manual for a UNIX-based system: ~$ curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"action":"add","requested":1,"type":"country","value":"NL"}' https://atlas.ripe.net/api/v2/measurements/100076/participation-requests/?ke y=YOUR_API_KEY And this is the version that needs to be used for a Windows system: C:\> curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d {\"action\":\"add\",\"requested\":1,\"type\":\"country\",\"value\":\"NL\"} https://atlas.ripe.net/api/v2/measurements/100076/participation-requests/?ke y=YOUR_API_KEY Apologies for the poor line-breaking in the above two examples in this email message. colin From: ripe-atlas [mailto:ripe-atlas-bounces at ripe.net] On Behalf Of Colin Strutt Sent: Sunday, April 2, 2017 10:38 AM To: ripe-atlas at ripe.net Subject: [atlas] Problems trying to add a probe to a measurement I'm trying to add a probe, by probe number, to an existing, running measurement, using curl, following the example and description on page 84 of the "RIPE Atlas API v2 manual". However, I'm getting an error message that does not clearly point me to the problem, and thus allow me to correct my error. Here's what I'm entering (with the <.> as placeholders, explained below) curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"probes":[{"action":"add","requested":1,"type":"probes","value":"<p>"}]}' https://atlas.ripe.net/api/v2/measurements/<m>/participation-requests/?key=< a> where: <p> is the number of the probe I'm trying to add, and I can access it at https://atlas.ripe.net/probes/<p> <m> is the measurement to which I'm trying to add it - it's a running measurement, and I can access it at https://atlas.ripe.net/measurements/<m> <a> is the API key, which is enabled and has "Update an existing measurement" granted The error I get back is: {"error":{"status":400,"code":104,"detail":"JSON parse error - No JSON object could be decoded","title":"Bad Request"}} In case it's relevant, I'm running curl 7.53.1 on Windows 10. Thanks in advance for any suggestions. colin -------------- next part -------------- An HTML attachment was scrubbed... URL: </ripe/mail/archives/ripe-atlas/attachments/20170407/8e6926ce/attachment.html>
- Previous message (by thread): [atlas] Problems trying to add a probe to a measurement
- Next message (by thread): [atlas] Behind the scenes changes to measurement creation
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]