aws api gateway

Posted on Actualizado enn

    1. Go to services and select api gateway under aplication services
    2. Create api, new api: Lectures, create
    3. Actions create resource: TempSensor, create resource
    4. Actions create method: post, then we integrate with a lambda function (see another post to create lambda function).
    5. You will get something like:
      You are about to give API Gateway permission to invoke your Lambda function:
      arn:aws:lambda:us-west-2:971111:function:RegisterLecture
    6. Click the test button (ligthening)
    7. in Request body, put the post in this case
    8. {
      “sensorID”: “temp001”,
      “temperatura”: “28.30”
      }

Request:/tempsensor Status: 200

Latency: 161 ms

Response Body

Agregado: temp001 28.30

9.Actions, deploy api, pick up [new], stagename:betahm, stage desc: blank, deployment desc: blank
10. After that we can use postman or RESTconsole to test Invoke URL, clicking the post/get method in left panel: https://aqxxxxkm6.execute-api.us-west-2.amazonaws.com/betahm/tempsensor

In case anyone else lands here with the same problem, here is what was going on: at the end of the tutorial, I clicked “Deploy API” in order to deploy the test call I had set up. This takes you to the “Stage Editor” for the given API stage. At the top of the editor page is an “Invoke URL”, which does not include the resource at the end of it. Clicking on the Invoke URL link brings up an authentication error response.

On the Stage Editor page, there is a left nav with the stage name. If you expand this you get a forward-slash; if you expand this, you get your resource. If you expand your resource you get your method, and if you click on the method you get an “Invoke URL” link (which is the same as the above but with the resource appended). This invoke URL link works, invoking the GET method and returning results.

Somewhat hidden, in my opinion, but once you know where to look for it it all makes sense.

 

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s