C# SDK - BatchFacade with Collections

Former Member
Former Member $organization

Greetings,

We've been working with the latest C# SDK and have begun working with the BatchFacade. We are liking the REST API and the SDK so far!

We've read some past TLCC presentations and a few other resources we were able to find on the network. We were able to find our way around some of our initial questions. We are stumped on one thing and are hoping somebody out there has done this (or knows it's not possible at the moment).

So we've been able to successfully use the BatchFacade to batch some basic calls. i.e. we can take a session key, get a session object, pass the constituent ID into constituent Info and get the Constituent back in one batch response. It makes sense and it works well.

Now we're interested in trying to feed a collection of attributes (ids, etc) into a batch request. We were wondering how to structure the DependsOnRequest and BatchRequest objects needed to do this. For example, say we are trying to get all of the performances within a season (75). We would get the Performance Seasons first as a collection and then feed those Ids somehow into the GetAll method for Performances. Does the BatchFacade allow this? If so then how would we change the code below? In theory this would work if the Production Seasons returned a single object instead of a collection.

While this isn't a practical application for us right now, we were asking the question over here since we may soon see the need to use the BatchFacade this way... if it's possible to do so. We understand that if this doesn't work in the way we're hoping then we can just break this into a few requests in our code. Any insight is appreciated. Thanks so much for your time. Below, it's implied that our tessituraService has been properly instantiated and credentialed.

 var dependsOnRequestValid = new List<DependsOnRequest> {
new DependsOnRequest() {
Id = 1,
IsUrlDependency = true,
SourcePath = "Id",
TargetPath = "ProductionSeasonIds",
},
};

BatchResponse batchResponse = await tessituraService.BatchFacade
.With(tessituraService.BatchFacade.Txn.ProductionSeasons.GetAll("75", "", "", null))
.With(tessituraService.BatchFacade.Txn.Performances.GetAll("", "", "", dependsOnRequestValid))
.Call();
Parents
  • Hi Randolph,

    Still quite new to the batching game but have you tried running the supplied code? It seems to make sense that it would work, as in, its along the same lines as calling a constituent and then getting details within in it which is what has worked for you so far. Do you get any error messages?

    Thanks

    Will

  • Former Member
    Former Member $organization in reply to William Gregg

    Thanks for the reply, William. Yeah, we did try and run this just to see what would happen and it did produce an error.

    We've found that debugging with the BatchFacade can be tricky at times (i.e. permission errors) but this particular issue is pretty straightforward. When we run this code the batch itself does not fail but the second response in the batch has an error:

    {INVALID_REQUEST_DEPENDENCY; BatchRequest.Request.DependsOnRequest.SourcePath; Batch request has at least one invalid dependency.}

    I understand this to be returned from the REST service itself and would indicate to me that the value that we've supplied for the SourcePath is incorrect. We did try a couple of things to see: curly braces, square braces, any number of things. We dug a little into the source code for the SDK and didn't find anything to indicate that it can handle the type of request above however, we could be overlooking something.

    If we had to guess on our end there probably isn't functionality to parse a collection of IDs from the response and then convert them into the comma-separated string needed... or even turn each individual item in the ProductionSeason collection into an individual batch request. Figured it was worth posing the question here before digging too much deeper. Thanks all.

Reply
  • Former Member
    Former Member $organization in reply to William Gregg

    Thanks for the reply, William. Yeah, we did try and run this just to see what would happen and it did produce an error.

    We've found that debugging with the BatchFacade can be tricky at times (i.e. permission errors) but this particular issue is pretty straightforward. When we run this code the batch itself does not fail but the second response in the batch has an error:

    {INVALID_REQUEST_DEPENDENCY; BatchRequest.Request.DependsOnRequest.SourcePath; Batch request has at least one invalid dependency.}

    I understand this to be returned from the REST service itself and would indicate to me that the value that we've supplied for the SourcePath is incorrect. We did try a couple of things to see: curly braces, square braces, any number of things. We dug a little into the source code for the SDK and didn't find anything to indicate that it can handle the type of request above however, we could be overlooking something.

    If we had to guess on our end there probably isn't functionality to parse a collection of IDs from the response and then convert them into the comma-separated string needed... or even turn each individual item in the ProductionSeason collection into an individual batch request. Figured it was worth posing the question here before digging too much deeper. Thanks all.

Children
No Data