Can anyone help me with the API Post Request monitoring

Synthetics Question Template

  • Please share a Permalink or a direct link to the synthetics monitor you have questions about:

  • Paste in any Script Snippets you are using or have tried so far in your troubleshooting:

  • Describe what are you seeing. How does that differ than what were you expecting to see?

Hi @pervala1 - Can you share some extra detail as to what you are looking for here?

You mention API Post Request monitoring, I assume you have a Synthetics API Test monitor?

Can you share a sample script that you have right for the community members here to help you build on?

Hi Ryan,
I don’t have any script, I need help on buidling Script for API Test Monitor.
I have Pro Access for New Relic Synthetics.

Hi @pervala1 - I created a template, which I admit may need updating to use the new features in Synthetics, which may help you get started. You can remove the maintenance check if this is not part of your requirements as this was written before Synthetic Monitor downtime was available.


Hi @stefan_garnham I am looking for API Test Template, I think you shared for browser.

Nope, I checked and the link I provided is for API. It references a previous topic for the Browser template that I had loaded previously.

1 Like

Let us know how you get on with that template from Stefan :smiley:

Hi Ryan,

I am new to synthetics API, I am not able to create API Post Template for my application. Can you help me with the language synthetics API is using so that I can search for syntax.

Hi, @pervala1: New Relic Synthetics uses NodeJS; the provided $http object is an instance of the request module.

I am getting the below error:
TypeError: Cannot read property ‘statusCode’ of undefined
at Request.eval [as _callback] (eval at JobResource.getScriptFn (/opt/runtimes/4.0.0/modules/synthetics-runner/lib/job-resource/index.js:78:19), :85:27)
at self.callback (/opt/runtimes/4.0.0/node_modules/request/request.js:185:22)
at Request.emit (events.js:182:13)
at Request.onRequestError (/opt/runtimes/4.0.0/node_modules/request/request.js:881:8)
at ClientRequest.emit (events.js:182:13)
at TLSSocket.socketErrorListener (_http_client.js:392:9)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)

Can you post your script? Difficult to debug without seeing the code.

I can post the script now.

Hey @pervala1 - did you get the script or link to the script that you could post here? Thanks!