|
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16486611#comment-16486611 ] Scott Gray commented on OFBIZ-4274: ----------------------------------- Hi Nicolas, The mapping would result in a JSON structure similar to this: {code:javascript} { "shipmentId": "10000", "destinationPostalAddress": { "contactMechId": "9015" }, "destinationTelecomNumber": { "contactMechId": "9025" }, "fromParty": { "partyId": "Company" }, "shipmentItems": [ { "product": { "productId": "GZ-2644" }, "shipmentItemSeqId": "00001", "quantity": 2.000000, "orderShipments": [ { "orderItemSeqId": "00001", "shipGroupSeqId": "00001", "quantity": 2.000000, "itemIssuances": [ { "issuedDateTime": "2015-05-16T10:49:17+0000", "quantity": 1.000000, "inventoryItemId": "9001" } ], "orderId": "DEMO10090" } ] } ], "originPostalAddress": { "contactMechId": "9200" }, "primaryShipGroupSeqId": "00001", "status": { "statusId": "SHIPMENT_PACKED" }, "shipmentPackages": [ { "packageContents": [ { "shipmentItemSeqId": "00001", "quantity": 1.000000 } ], "shipmentPackageSeqId": "00001", "dateCreated": "2015-05-16T10:49:17+0000" } ], "toParty": { "partyId": "DemoCustomer" }, "shipmentRouteSegments": [ { "carrierPartyId": "UPS", "destTelecomNumberId": "9025", "carrierServiceStatusId": "SHRSCS_NOT_STARTED", "originFacilityId": "WebStoreWarehouse", "originTelecomNumberId": "9201", "shipmentPackages": [ { "shipmentPackageSeqId": "00001" } ], "shipmentRouteSegmentId": "00001", "originContactMechId": "9200", "destContactMechId": "9015", "shipmentMethodTypeId": "NEXT_DAY" } ], "originFacility": { "facilityId": "WebStoreWarehouse" }, "primaryOrderId": "DEMO10090", "type": { "shipmentTypeId": "SALES_SHIPMENT" }, "originTelecomNumber": { "contactMechId": "9201" } } {code} The API might look something like this (I'm making it up on the spot): {code:groovy} shipment = ResourceAPI.use(delegator).resource("shipment").get("10000") shipment.shipmentItems.each { shipmentItem -> shipmentItem.orderShipments.each { orderShipment -> Debug.log("${shipment.shipmentId}/${shipmentItem.shipmentItemSeqId} shipped ${orderShipment.quantity} units of ${shipmentItem.product.productId} from order ${orderShipment.orderId}/${orderShipment.orderItemSeqId}") } } // perform an update on the resource shipment.status.statusId = "SHIPMENT_SHIPPED" ResourceAPI.use(delegator).resource("shipment").post(shipment) {code} So instead of working on individual table records to read and write, you'd be working on a view of the entire shipment document. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Affects Versions: Trunk > Reporter: Adrian Crum > Priority: Major > Labels: REST > Attachments: RestExampleSchema.xsd, RestXmlRepresentation.xml, rest-conf.xml, swagger-pos-openapi.png > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. > [here is the discussion which took place on the dev ML|http://markmail.org/message/ai6q2fbksowaayn4] -- This message was sent by Atlassian JIRA (v7.6.3#76005) |
| Free forum by Nabble | Edit this page |
