Try our conversational search powered by Generative AI!

returning multiple blocks in a single call

Nat
Nat
Vote:
 

I was under the impression that you could query the api to get multiple blocks in one call like so

https://mysite.com/api/episerver/v3.0/content/7,10,15

as documented here: https://docs.developers.optimizely.com/content-cloud/v1.5.0-content-delivery-api/reference/content_querycontent

however I am finding I simply get a 404 when I do that, whereas making the call individually (https://mysite.com/api/episerver/v3.0/content/7) works fine

is there a setting I am missing somewhere?

this is the ContentApiOptions in my Startup.cs

      services.AddContentDefinitionsApi(OpenIDConnectOptionsDefaults.AuthenticationScheme);
      services.AddContentDeliveryApi(OpenIDConnectOptionsDefaults.AuthenticationScheme)
        .WithFriendlyUrl();
  
    services.Configure<ContentApiOptions>(options =>
      {
        options.ValidateTemplateForContentUrl = false;
        options.FlattenPropertyModel = false;
        options.EnablePreviewMode = true;
        options.IncludeEmptyContentProperties = false;
        options.IncludeMasterLanguage = false;
        options.ForceAbsolute = true;
        options.IncludeInternalContentRoots = false;
        options.IncludeSiteHosts = false;
        options.ExpandedBehavior = ExpandedLanguageBehavior.RequestedLanguage;
        options.IncludeNumericContentIdentifier = true;
        options.EnablePreviewFeatures = true;
        options.IncludeMasterLanguage = false;
      });
#280162
Edited, May 11, 2022 7:32
Vote:
 

Hi,

If you're trying to retrieve multiple items, I think you need to use a named parameter rather than passing the IDs as a URL segment. It should work if you change the URL you're calling to be:

https://mysite.com/api/episerver/v3.0/content/?References=7,10,15

#280165
May 11, 2022 8:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.