{
"data": {
"type": "contacts",
"id": 4847986,
"attributes": {
"middleName": "Howard",
By default in the response for links, it’s adding the default location url route as prefix when we use options.UseRelativeLinks = false; . In our case we want to replace the prefix with our own domain value instead of the request domain. (Our scenario: we are our API’s behind the API gateway in a separate data center, so we wanted to get the route prefix as the apigateway url instead of where it’s hosted)
Current response
{
"links": {
"self": https://api.test.com/customers
},
"data": {
"type": "customers",
"id": "5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e",
"attributes": {
"firstName": "FN110211",
"lastName": "LN110211",
"companyName": "Cpny110211",
"email": test110211@yopmail.com,
"phoneNumber": "614-334-3290",
"accountNumber": "00000707",
"customerReferenceNumber": "Ref110211",
"cultureCode": "en-US",
"manageSecurity": true,
"tenantId": "0685d838-7cc1-47f0-94af-b92564cff1aa",
"billingAddress": {
"addressLine1": "Francisco Expressway",
"addressLine2": "96152 Swaniawski Curve",
"city": "Smyrna",
"state": "OH",
"postalCode": "19348",
"countryCode": "SE"
}
},
"relationships": {
"partner": {
"links": {
"self": https://api.test.com/customers/5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e/relationships/partner,
"related": https://api.test.com/customers/5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e/partner
}
}
},
"links": {
"self": https://api.test.com/customers/5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e
}
}
}
Request url : https://api.dev.gateway.com/customers
API hosted at : https://api.test.com/customers
What we want response links should have https://api.dev.gateway.com instead of https://api.test.com
Hi,
We have Added JsonApiResourceService (ex: services.AddScoped<IResourceService<Customer, Guid>, CustomerService>();) in Startup.cs and kept all our validations and business logic in the class by inherting JsonApiResourceService<Customer, Guid>.
But when we invoke the Unittest we are facing the "object reference not set to an instance of an object " error in this line: return base.GetAsync(cancellationToken);
Please help how we can mock the JsonApiResourceService<Customer, Guid>?
We are using v4.2 for an Ember app. The app allows the user to create fairly complex filters, which JADNC handles wonderfully.
However, now we need access to the LINQ statement that is generated from the user's defined filter and use the LINQ in a long-running background task. The background task creates a report that can be later downloaded.
I would love some guidance around the layer of JADNC that we can "intercept" the LINQ statement that the user's filter produces.
I am trying to avoid duplicating the work JADNC does to convert the query string into LINQ.
Hi all, when deleting entities in 5.0.0-pre, did someone else notice errors in the trend of:
Failed to persist changes in the underlying data store.
JsonApiDotNetCore.Repositories.DataStoreUpdateException: Failed to persist changes in the underlying data store.
---> Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
? It seems to happen with most of my resources but didn't notice it yet before. The query that is generated does seem to make sense:
DELETE FROM datapoints
WHERE id = @p0 AND project_id = @p1;
Hi, I have a DB with tables:
-Objects
-Groups
-GroupsObjects
-Users
-UsersObjects
-UsersGroups
-UsersObjects
So an Object can be linked to one User directly or indirectly via a Group, or even both.
When I browse the Users route with included Objects, i have only the objects linked directly to the Users. But I want to know if there is an easy way to include all the Objects (those linked directly to the User and those linked to the User via Group table). All this without link them in DB.
The only way i see is by overriding the OnSerialize function in UserDefinition and add Objects from Groups in the User manually.
Hope it's clear :)
Hi @bart-degreed, I've just spent some time upgrading to JADNC 5.0.0-pre and EFCore6 and noticed that nested paging still seems to be broken. I've observed that EFCore6 is producing a query that has TOP (PageSize)
and on the nested relationship it also using Row_Number
, the end result is a query that takes 2+mins(timeout) to run but when I turn back on the workaround all is good. Have you observed any weirdness in this area? I'll try and create a repo of the issue.
We are developing a rich REST Api usingJsonApiDotNetCore library (5.0.1). We have many dozens of APIs working just fine.
However, today I updated my VS 2022 to 17.3.0, and now when I try to run I get the error JsonApiDotNetCore.Errors.InvalidConfigurationException with the message "Multiple controllers found for resource type ..."
Running the same source on a non-updated VS2022 works just fine.
Any clues out there?