Skip to main content
17-Peridot
November 29, 2023
Question

Resources["ContentLoaderFunctions"].Delete() produces a "Read timed out" error

  • November 29, 2023
  • 1 reply
  • 3399 views

Hello community,

 

While doing tests on creating/deleting projects, I am trying to use the following function:

let url = '.../Thingworx/' + entity.type + "s/" + entity.name
var params = {
 headers: {
 "appKey": appKey,
 "Content-type": "application/json",
 "Accept": "application/json"
 } /* JSON */ ,
 url: url /* STRING */
};
Resources["ContentLoaderFunctions"].Delete(params)

 

For some reason though it is SUPER slow (and seems to be causing me to not be able to delete entities manually in the composer at the same time).

I do get the following error in my ScriptLog:

JavaException: java.net.SocketTimeoutException: Read timed out

Eventually though, the entities are deleted and I can see this in the "ConfigurationLog":

jensc_1-1701269247566.png

 

Which confirms that the "Administrator" (user used for the AppKey during tests) had deleted the entities.

 

But what could be the reason for the time out issue?

 

Thanks,

Jens C.

1 reply

17-Peridot
November 29, 2023

@jensc ,

 

If you make the same call in Insomnia or PostMan, do you see the same delay?  Additionally, is there a reason why you're using the ContentLoader functions to delete entities and not the built-in services?

 

-Nick

jensc17-PeridotAuthor
17-Peridot
November 30, 2023

Hello @nmilleson,

 

When trying from Insomnia (and running the service from the composer), nothing really happens. I get a response 200 back in insomnia, but the entity still remains. Perhaps my request is wrong?

Body:

jensc_0-1701332087848.png

Header:

jensc_1-1701332126059.png

 

The reason why I am using the contentloader for deleting this entity is because there is no entityservice to delete mashups (and some other entity types).

If you know of any other services that can actually delete stuff like mashups, menus etc, then I'd be happy to give it a shot though!

 

Thanks,

Jens C

16-Pearl
November 30, 2023

(you are doing a POST request in your screenshote instead of a DELETE request)

edit: ah I just noticed you call the contenloaderfunction service. so POST would be ok. But why not bypass the ContenLoaderFunction and call DELETE on 

'.../Thingworx/' + entity.type + "s/" + entity.name

I think this was the idea if this even works