Cancel
Showing results for 
Search instead for 
Did you mean: 

Assets created using APIs are not fetched by /assets API

Hello,

 

I am able to create Aspects, Asset Types and Assets using AssetManagement PUT request.

 

However when I fetch the assets using "/api/assetmanagement/v3/assets", I only get assets that were manually created using Asset Manager Application, the Assets created using APIs are not listed in response.

 

Any ideas?

 

 

Regards,

Parag

 

5 REPLIES

Re: Assets created using APIs are not fetched by /assets API

Siemens Genius Siemens Genius
Siemens Genius

I have created thousands of assets programmatically using POST, and dozens of asset types and aspect types using PUT, using following base URLs:

/api/assetmanagement/v3/assets

/api/assetmanagement/v3/assettypes

/api/assetmanagement/v3/aspecttypes

 

I was able to view these instantly from my program using GET requests. Therefore I can tell you that it can be done.

 

You wrote that you used PUT. Please remember that for creating assets you need to use POST.

Re: Assets created using APIs are not fetched by /assets API

Hi Robert,

Thanks for your reply.

You are right about POST, sorry that was my mistake, I of course created assets using POST and not PUT.

However, just observed that it doesn't matter how many assets I have in my tenant, "api/assetmanagement/v3/assets" is always returning me first 10 assets based on alphabetical sorting.

Is there a way where I can get ALL assets in the tenant? Is this a API limitation or has to do something with my plan being S?

Regards,
Parag

Re: Assets created using APIs are not fetched by /assets API

Siemens Genius Siemens Genius
Siemens Genius

You can supply the 'size' parameter to request how many assets to list in one page, e.g. 1000. If you have more than that many assets you can then flip through pages, as specified by you in the 'page' parameter. To know how many assets match your query you can look at the 'page' response field, where the subfields 'totalElements' and 'totalPages' are most relevant.

 

Have a look at the API doc for more details.

Re: Assets created using APIs are not fetched by /assets API

Thanks Robert! It works when I give 'size' parameter.

It seems by default the size is set to 10 hence I was getting only 10.

Regards,
Parag

Re: Assets created using APIs are not fetched by /assets API

Siemens Genius Siemens Genius
Siemens Genius

Yes, this is the documented behaviour as mentioned here. By the way, the MindSphere documentation contains much useful information. As they used to say back at university, "an hour in the library could save you a month in the lab".