none
How to get only published assets via rest api RRS feed

  • Question

  •  i am publishing my assets via azure portal and using rest API to get assets and other information.The core issue is that when i call the rest API end point

         " {{RESTAPIEndpoint}}/Assets "

    i got the list of all assets from our storage account of azure portal I want to get only the published assets via rest API.

    Thursday, July 11, 2019 9:15 AM

All replies

  • Thanks for asking Question! As mentioned in this Document “ The Publish action has been deprecated. Starting with the latest Media Services release, publish should not be used. If your code uses Publish, be aware of the following considerations:

    • The Publish action does not delete locators associated with the asset. You must explicitly delete the locators in code after calling Publish.
    • The Publish action does not set the asset state to Published. Remove the code that checks whether an asset is in the Published state. Currently, an asset can only have the Initialized or Deleted state.”

    Thursday, July 11, 2019 11:48 AM
    Moderator
  •  dont actually recommend using the v2 APi for this type of query. V3 is better because the v2 only returns the top 1000. In v3 you can page through with the NextPage link if the list is really long.

    WARNING on these types of queries though - You may be throttled if volume of such requests is too high. So if you plan to do this a lot, you may want to move the metadata to another DB (like Cosmos) for expensive queries. AMS is not really an asset management system, and you should do more expensive UX level queries in another tier using the Asset ID as the foreign key.

    This is what paging looks like in the v3 Client for .NET

    var firstPage = await client.StreamingLocators.ListAsync(resourceGroupName, accountName); 
    var currentPage = firstPage; 
    
    while (currentPage.NextPageLink != null) { 
       currentPage = await MediaServicesArmClient.StreamingLocators.ListNextAsync(currentPage.NextPageLink);
    }

    You would need to get the Asset ID, and then also list through Streaming Locators that are using that Asset ID. Because there could be n-number of Streaming Locators published with that Asset ID.


    Thursday, July 11, 2019 8:29 PM