Getting did not provide valid JSON data error while running my collection from Newman

Hi Team,

we are facing issue while accessing my collection from newman.

error: collection could not be loaded
the url “https://www.getpostman.com/collections/7c305b7e7af4f49f93b6” did not provide valid JSON data
Unexpected token ‘<’ at 1:1

^

It was working fine 2 days back.
Can someone please help.

Regards
Jiten

Hello Jiten,
your postman URL is not working, If you make any changes in your collection then you need to update the URL.
Please share it again, so, we can see your code and help you to fix the issue.

This is the latest and updated URL. If its not working then maybe there is an issue with how Postman is generating the URL. I have updated the URL again in case it helps.

still not working for me😔
Did you follow these steps to get your collection public link?
or share your code in text form.

Yes, I have been using Postman and Newman since last 6 months. And everything was working fine till day before. Don’t know what happened. Other collections are working fine. Issue is with this collection only. You can try with the following link. Just generated:

https://www.getpostman.com/collections/e2ea7683ddf6bfc355d3

It’s showing 502 Bad Gateway

Exactly. Thats why Newman is unable to get data. Issue is Postman generating the link. Try the following for another collection. This one’s working fine.

https://www.getpostman.com/collections/3ba87bf2877688b4fa4d

Yes, it’s showing a json object.

So can you help me understand whats the issue with the collection link that I want to use. Its working fine with Postman. Issue comes up with shared link.

I can see the JSON response when opening that link.

What command are you using for Newman add can you show the error message you see in the console output?

Also, I’d strongly suggest that you use the Postman API with an Auth token rather than the public shared link, that can potentially contain sensitive information.

We need to run this collection through Jenkins, so we don’t have any other option but to use a Public link. Getting the following Error:

Which version of Newman is that using?

Is there some sort of VPN or firewall preventing that URL from opening correctly?

I’m using newman “version”: “5.2.2” , No there is no firewall preventing opening this, as other collections URL is opening properly.

only below collection URL is not working.

https://www.getpostman.com/collections/e2ea7683ddf6bfc355d3

It looks like that link doesn’t exist anymore, it may have been deleted or the Collection might have been deleted.

A subset of that response information:

{
"result": "error",
"name": "instanceNotFoundError",
"statusCode": 404,
"event": "Link does not exist.",
}

If you go to the Share option and recreate a public link for the Collection, then run this with Newman is it working.

Again, I would use the Postman API for this for reasons of security more than anything else but it’s also a realtime view of the Collection rather than something you need to manually update each time you make a change.

newman run https://api.getpostman.com/collections/{{collection_uid}}?apikey={{APIKey}}

More information on the Postman API can be found in the Postman Public Workspace:

https://www.postman.com/postman/workspace/postman-public-workspace/request/12959542-e52ed203-8c5f-4c71-88fd-c6662f4a4e15?ctx=documentation