How to query a contractNegotiation for a given contractAgreementId in management api? #617
Unanswered
DrDanielMetz
asked this question in
Q&A
Replies: 1 comment
-
This was discussed on upstream: eclipse-edc/Connector#2316 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It is possible to query a contract agreement with the following management api call (example):
POST {{CONSUMER_DATAMGMT_URL}}/contractagreements/request
with request body (example):
{ "@context": { "dct": "https://purl.org/dc/terms/", "tx": "https://w3id.org/tractusx/v0.0.1/ns/", "edc": "https://w3id.org/edc/v0.0.1/ns/", "odrl": "http://www.w3.org/ns/odrl/2/", "dcat": "https://www.w3.org/ns/dcat/", "dspace": "https://w3id.org/dspace/v0.8/" }, "filterExpression": { "edc:operandLeft": "assetId", "edc:operator": "=", "edc:operandRight": "22062023-6" } }
With this, it is possible to get the contract agreement for a sepcific asset id. This works.
Now, I want to query the contract negotiation for the resolved contract agreement id with this query:
POST {{CONSUMER_DATAMGMT_URL}}/contractnegotiations/request
I tried it with the following request payloads:
1st try:
{ "@context": { "dct": "https://purl.org/dc/terms/", "tx": "https://w3id.org/tractusx/v0.0.1/ns/", "edc": "https://w3id.org/edc/v0.0.1/ns/", "odrl": "http://www.w3.org/ns/odrl/2/", "dcat": "https://www.w3.org/ns/dcat/", "dspace": "https://w3id.org/dspace/v0.8/" }, "filterExpression": { "edc:operandLeft": "contractAgreementId", "edc:operator": "=", "edc:operandRight": "22062023-6-cd:22062023-6:8362a121-3790-4976-ba1a-5caf3a435b42" } }
Result:
Error validating schema: Field contractAgreementId not found on type class org.eclipse.edc.connector.contract.spi.types.negotiation.ContractNegotiation
2nd try:
{ "@context": { "dct": "https://purl.org/dc/terms/", "tx": "https://w3id.org/tractusx/v0.0.1/ns/", "edc": "https://w3id.org/edc/v0.0.1/ns/", "odrl": "http://www.w3.org/ns/odrl/2/", "dcat": "https://www.w3.org/ns/dcat/", "dspace": "https://w3id.org/dspace/v0.8/" }, "filterExpression": { "edc:operandLeft": "https://w3id.org/edc/v0.0.1/ns/contractAgreementId", "edc:operator": "=", "edc:operandRight": "22062023-6-cd:22062023-6:8362a121-3790-4976-ba1a-5caf3a435b42" } }
Result:
Error validating schema: Field https://w3id not found on type class org.eclipse.edc.connector.contract.spi.types.negotiation.ContractNegotiation
3rd try:
{ "@context": { "dct": "https://purl.org/dc/terms/", "tx": "https://w3id.org/tractusx/v0.0.1/ns/", "edc": "https://w3id.org/edc/v0.0.1/ns/", "odrl": "http://www.w3.org/ns/odrl/2/", "dcat": "https://www.w3.org/ns/dcat/", "dspace": "https://w3id.org/dspace/v0.8/" }, "filterExpression": { "edc:operandLeft": "contractAgreement", "edc:operator": "=", "edc:operandRight": "22062023-6-cd:22062023-6:8362a121-3790-4976-ba1a-5caf3a435b42" } }
Result:
The field validation error is gone. However, I am getting a http response code 500.
On the log of the EDC control plane I can see:
SEVERE 2023-07-14T13:48:46.998647181 JerseyExtension: Unexpected exception caught org.eclipse.edc.spi.EdcException: Translation failed for Model 'org.eclipse.edc.connector.store.sql.contractnegotiation.store.schema.postgres.ContractAgreementMapping' input canonicalPropertyName is null at org.eclipse.edc.transaction.local.LocalTransactionContext.execute(LocalTransactionContext.java:81) at org.eclipse.edc.connector.store.sql.contractnegotiation.store.SqlContractNegotiationStore.queryNegotiations(SqlContractNegotiationStore.java:150) at org.eclipse.edc.connector.service.contractnegotiation.ContractNegotiationServiceImpl.lambda$query$1(ContractNegotiationServiceImpl.java:64) at org.eclipse.edc.transaction.local.LocalTransactionContext.execute(LocalTransactionContext.java:74) at org.eclipse.edc.connector.service.contractnegotiation.ContractNegotiationServiceImpl.query(ContractNegotiationServiceImpl.java:64) at org.eclipse.edc.connector.api.management.contractnegotiation.ContractNegotiationApiController.queryNegotiations(ContractNegotiationApiController.java:86) at jdk.internal.reflect.GeneratedMethodAccessor132.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177) at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81) at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81) at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:261) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) at org.glassfish.jersey.internal.Errors.process(Errors.java:292) at org.glassfish.jersey.internal.Errors.process(Errors.java:274) at org.glassfish.jersey.internal.Errors.process(Errors.java:244) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:240) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:697) at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:357) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) at org.eclipse.jetty.server.Server.handle(Server.java:563) at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: Translation failed for Model 'org.eclipse.edc.connector.store.sql.contractnegotiation.store.schema.postgres.ContractAgreementMapping' input canonicalPropertyName is null at org.eclipse.edc.sql.translation.TranslationMapping.getStatement(TranslationMapping.java:41) at org.eclipse.edc.sql.translation.TranslationMapping.getStatement(TranslationMapping.java:54) at org.eclipse.edc.sql.translation.SqlQueryStatement.parseExpression(SqlQueryStatement.java:151) at org.eclipse.edc.sql.translation.SqlQueryStatement.lambda$initialize$1(SqlQueryStatement.java:125) at java.base/java.util.ArrayList.forEach(Unknown Source) at org.eclipse.edc.sql.translation.SqlQueryStatement.initialize(SqlQueryStatement.java:125) at org.eclipse.edc.sql.translation.SqlQueryStatement.<init>(SqlQueryStatement.java:60) at org.eclipse.edc.connector.store.sql.contractnegotiation.store.schema.postgres.PostgresDialectStatements.createNegotiationsQuery(PostgresDialectStatements.java:36) at org.eclipse.edc.connector.store.sql.contractnegotiation.store.SqlContractNegotiationStore.lambda$queryNegotiations$5(SqlContractNegotiationStore.java:152) at org.eclipse.edc.transaction.local.LocalTransactionContext.execute(LocalTransactionContext.java:74) ... 58 more
It is not clear to me, how I can simply get the negotiation for a given contract agreement id.
EDC version: 0.4.1
Beta Was this translation helpful? Give feedback.
All reactions