Cannot perform a web post request to a server from notecard

I’m trying to perform a web transaction as described here.
I’ve set the route this way:
Route name: post_test
URL: https://posttestserver.dev/p/y1fyj8gy56w23i09/post
Notefiles: Selected Notefiles: System Notefiles + barcode.qo
Data:Transform Data: JSONata Expression: {“qr”:(body.qr)}

This is my example data (sent using the web serial terminal connected by USB to the notecard):

{
  "req": "web.post",
  "route": "post_test",
  "name": "/post",
  "body": { "qr": "test1" }
}

The response I get is this:

{
 "result": 503,
 "body": {
  "err": "hub request error: notehub route with alias 'post_test' cannot be found"
 }
}

However, if I try to send it using a note.add request this way:

{
  "req": "note.add",
  "file": "barcode.qo",
  "body": { "qr": "test" },
  "sync": true
}

It works, I get a {“total”:1} response and I see in notehub and at the server the data & code 200.
However, this way I have no idea that the data went through and what was the servers response.
I tried it with a different server and got the same “notehub route with alias … cannot be found” error.
Am I doing something wrong?
Thanks,
Ziv

Shame on me… I missed the part in the documentation that states that a different “Proxy for Notecard Web Requests” type of route needs to be made. all is well now :slight_smile:

1 Like