Open DiegoCont opened 2 years ago
@DiegoCont, are you accidentally including the nextLink
as well in your final page? From the OData spec:
A page of results MUST NOT have both a deltaLink control information and a nextLink control information
If this is the issue, I think that we should change this error message, since it does not reflect the actual problem.
@corranrogue9 I'm actually setting my deltaLink as the 'nextPAgeLink' property. I'm using this PageResult object https://github.com/OData/WebApi/blob/master/src/Microsoft.AspNet.OData.Shared/PageResult.cs and don't see a specific deltaLink property, so I set the nextPageResult to be my url with either a next or delta token. Basically, I'm doing it like this:
new PageResult( items: response.Items, nextPageLink: deltaLink, (this is the url I'm creating that has my deltaToken) count: count);
Is this the correct way to create a delta url? If not, could you please share an example on how to set the delta url? My logic to create next/delta link is basically the same, the main difference is either I add a delta or skip token (and the url type I want to return).
I'm trying to update my api to support delta link/token. When I return a nextLink for my first responses, it works fine, but for the final response, when I try to return a deltaLink along a deltaToken, I get this error: { "error": { "code": "InternalServerError", "message": "nextLink value without skip or skiptoken", "innerError": { "date": "2022-07-12T23:45:24", "request-id": "e8e9b13b-c838-41ce-9043-a8c4904c7759", "client-request-id": "e8e9b13b-c838-41ce-9043-a8c4904c7759" } } }
Assemblies affected
Microsoft.AspNetCore.OData 7.5.7
Reproduce steps
Create deltalink url as expected: NameValueCollection nameValues = HttpUtility.ParseQueryString(queryString); nameValues.Remove("$skipToken"); nameValues.Set("$deltatoken", continuationToken); Uri nextPageLink = new Uri(path + "?" + nameValues.ToString(), UriKind.Relative); oDataFeature.DeltaLink = nextPageLink ;
I see the URL is a correct url with a deltaToken.
Create PageResult (also correct result) return new PageResult(
items: response.Items,
nextPageLink: nextPageLink,
count: count);
Expected result
response with a deltaLink along my deltaToken
Actual result
Error with message: "nextLink value without skip or skiptoken",
Additional detail
My guess is it's expecting a skipToken or skip value in order to return a nextLink but I don't want that I want a deltaLink, how do I fix this? I do not see a deltaLink property in PageResult