/
API: Footwear > Create Purchase Order

API: Footwear > Create Purchase Order

Resource URL:

http://<hostname>/ws/api/purchase_order/createPO

Parameters:

nameData TypeRequired/OptionalExampleDescription
userNameStringRequiredchinFor authentication
passwordStringRequired123456For authentication
poJsonStringRequiredSample data is listed belowThis is json string of PO Object

Sample json data

{
    "mPkid": 1230,
    "mGuid": "492148BE-B02B-4183-9E60-222898EB30B2",
    "mPosPkid": 0,
    "mStmtNumber": 7,
    "mPurchaseTxnId": 0,
    "mTimeCreated": "Nov 15, 2013 5:56:23 PM",
    "mTimeComplete": "Nov 15, 2013 5:56:23 PM",
    "mRequestorId": 500,
    "mApproverId": 500,
    "mCurrency": "MYR",
    "mRemarks": "",
    "mState": "created",
    "mStatus": "active",
    "mLastUpdate": "Nov 15, 2013 5:56:23 PM",
    "mUserIdUpdate": 500,
    "mCcyPair": "",
    "mXRate": 7,
    "mEntityTable": "supp_account_index",
    "mEntityKey": 1001,
    "mEntityName": "JET MACHINERY SDN BHD",
    "mEntityType": "",
    "mIdentityNumber": "",
    "mEntityContactPerson": " ",
    "mEntityAdd1": "",
    "mEntityAdd2": "",
    "mEntityAdd3": "NO.7,JALAN SS/13/3E",
    "mEntityPostcode": "47500",
    "mEntityState": "SELANGOR D.E.",
    "mEntityCountry": "",
    "mEntityTelephone": "03-56363248Ext",
    "mEntityFax": " -",
    "mEntityEmail": "sales@jet.com.my",
    "mSuppProcCtrId": 3,
    "mLocationId": 1002,
    "mPCCenter": 3,
    "mTxnType": "",
    "mAmount": 4150,
    "mStmtType": "",
    "mReferenceNo": "",
    "mDescription": "",
    "mTermsDate": "Dec 15, 2013 12:00:00 AM",
    "mShipTo": "",
    "mProperty1": "",
    "mProperty2": "",
    "mOrderType": "",
    "SuppProcessStatus": "",
    "mForeignTable": "",
    "mForeignKey": 0,
    "mDefaultRowsNumber": 15,
    "incoterms": "",
    "permitNo": "",
    "permitDoc1": "",
    "permitDoc2": "",
    "permitDoc3": "",
    "txnDoc1": "",
    "txnDoc2": "",
    "txnDoc3": "",
    "transportDoc1": "",
    "transportDoc2": "",
    "transportDoc3": "",
    "transportDate": "Jan 1, 0001 12:00:00 AM",
    "tradersRemarks": "",
    "requestedDate": "Nov 15, 2013 5:56:23 PM",
    "remarks2": "",
    "whtTaxType": "",
    "whtTaxCode": "",
    "whtTaxRate": 0,
    "whtTaxAmount": 0,
    "whtTaxBalance": 0,
    "whtFilingDate": "Jan 1, 0001 12:00:00 AM",
    "whtFilingCycle": "",
    "label_id": 0,
    "groupDiscount": 0,
    "tax_id": "",
    "vecPurchaseOrderItems": [
        {
            "mPkid": 1829,
            "mGuid": "",
            "mIndexGuid": "",
            "mPurchaseOrderId": 1228,
            "mPurchaseItemId": 0,
            "mRemarks": "",
            "mTotalQty": 2,
            "mCurrency": "MYR",
            "mUnitPriceRecommended": 500,
            "mUnitPriceQuoted": 405,
            "mStatus": "active",
            "mPurchaseItemType": "inv",
            "mItemId": 1007,
            "mStkCode": "ATL4251320K",
            "mBarCode": "",
            "mSerialized": true,
            "mName": "1/2\"x3/8\"x16TPI T-SLOT MACHINE CLAMP SET",
            "mOutstandingQty": 0,
            "mPriceList": 0,
            "mPriceSale": 0,
            "mPriceDisc1": 0,
            "mPriceDisc2": 0,
            "mPriceDisc3": 0,
            "mPriceMin": 0,
            "mFifoUnitCost": 0,
            "mMaUnitCost": 0,
            "mWaUnitCost": 0,
            "mLastUnitCost": 0,
            "mReplacementCost": 0,
            "mReceivingPrice": 450,
            "mReceivingStatus": "",
            "mReceivingQty": 2,
            "mReceivingRemarks": "",
            "colSerial": [],
            "colSerialObj": [],
            "mDescription1": "",
            "mDescription2": "",
            "mUnitPriceQuoted3": 0,
            "mImage": 0,
            "whtTaxType": "",
            "whtTaxCode": "",
            "whtTaxRate": 0,
            "whtTaxAmount": 0,
            "whtTaxBalance": 0,
            "whtFilingDate": "Jan 1, 0001 12:00:00 AM",
            "whtFilingCycle": "",
            "vecSerialNumberDelta": [],
            "mBomId": 0,
            "mPackageGroup": "",
            "mCurrency2": "",
            "mUnitPriceQuoted2": 0,
            "mStockReqId": 0,
            "taxCode": "",
            "taxType": "",
            "taxRate": 0,
            "taxAmt": 0,
            "taxAmt2": 0,
            "mUnitPriceRecommended2": 0,
            "taxOption": "",
            "uom": "EA",
            "uomRatio": 0,
            "date_expected_delivery": "Nov 16, 2013 12:00:00 AM",
            "codeProject": "",
            "codeDepartment": "",
            "vecLabels": [],
            "label_id": 0,
            "remoteStatus": "",
            "unitDiscount": 0,
            "unitDiscount2": 0,
            "vecDiscountElement": []
        },
        {
            "mPkid": 1830,
            "mGuid": "",
            "mIndexGuid": "",
            "mPurchaseOrderId": 1228,
            "mPurchaseItemId": 0,
            "mRemarks": "",
            "mTotalQty": 2,
            "mCurrency": "MYR",
            "mUnitPriceRecommended": 500,
            "mUnitPriceQuoted": 405,
            "mStatus": "active",
            "mPurchaseItemType": "inv",
            "mItemId": 1007,
            "mStkCode": "ATL4251320K",
            "mBarCode": "",
            "mSerialized": true,
            "mName": "1/2\"x3/8\"x16TPI T-SLOT MACHINE CLAMP SET",
            "mOutstandingQty": 0,
            "mPriceList": 0,
            "mPriceSale": 0,
            "mPriceDisc1": 0,
            "mPriceDisc2": 0,
            "mPriceDisc3": 0,
            "mPriceMin": 0,
            "mFifoUnitCost": 0,
            "mMaUnitCost": 0,
            "mWaUnitCost": 0,
            "mLastUnitCost": 0,
            "mReplacementCost": 0,
            "mReceivingPrice": 450,
            "mReceivingStatus": "",
            "mReceivingQty": 2,
            "mReceivingRemarks": "",
            "colSerial": [],
            "colSerialObj": [],
            "mDescription1": "",
            "mDescription2": "",
            "mUnitPriceQuoted3": 0,
            "mImage": 0,
            "whtTaxType": "",
            "whtTaxCode": "",
            "whtTaxRate": 0,
            "whtTaxAmount": 0,
            "whtTaxBalance": 0,
            "whtFilingDate": "Jan 1, 0001 12:00:00 AM",
            "whtFilingCycle": "",
            "vecSerialNumberDelta": [],
            "mBomId": 0,
            "mPackageGroup": "",
            "mCurrency2": "",
            "mUnitPriceQuoted2": 0,
            "mStockReqId": 0,
            "taxCode": "",
            "taxType": "",
            "taxRate": 0,
            "taxAmt": 0,
            "taxAmt2": 0,
            "mUnitPriceRecommended2": 0,
            "taxOption": "",
            "uom": "EA",
            "uomRatio": 0,
            "date_expected_delivery": "Nov 16, 2013 12:00:00 AM",
            "codeProject": "",
            "codeDepartment": "",
            "vecLabels": [],
            "label_id": 0,
            "remoteStatus": "",
            "unitDiscount": 0,
            "unitDiscount2": 0,
            "vecDiscountElement": []
        }
    ]
}

Detail of Purchase Order Object

Purchase Order Object has 2 sections:

INDEX

Index contains basic/header information of PO. To create a PO it must have only one PO Index data.

Sample json data of PO Index Object

{
    "mPkid": 1230,
    "mGuid": "492148BE-B02B-4183-9E60-222898EB30B2",
    "mPosPkid": 0,
    "mStmtNumber": 7,
    "mPurchaseTxnId": 0,
    "mTimeCreated": "Nov 15, 2013 5:56:23 PM",
    "mTimeComplete": "Nov 15, 2013 5:56:23 PM",
    "mRequestorId": 500,
    "mApproverId": 500,
    "mCurrency": "MYR",
    "mRemarks": "",
    "mState": "created",
    "mStatus": "active",
    "mLastUpdate": "Nov 15, 2013 5:56:23 PM",
    "mUserIdUpdate": 500,
    "mCcyPair": "",
    "mXRate": 7,
    "mEntityTable": "supp_account_index",
    "mEntityKey": 1001,
    "mEntityName": "JET MACHINERY SDN BHD",
    "mEntityType": "",
    "mIdentityNumber": "",
    "mEntityContactPerson": " ",
    "mEntityAdd1": "",
    "mEntityAdd2": "",
    "mEntityAdd3": "NO.7,JALAN SS/13/3E",
    "mEntityPostcode": "47500",
    "mEntityState": "SELANGOR D.E.",
    "mEntityCountry": "",
    "mEntityTelephone": "03-56363248Ext",
    "mEntityFax": " -",
    "mEntityEmail": "sales@jet.com.my",
    "mSuppProcCtrId": 3,
    "mLocationId": 1002,
    "mPCCenter": 3,
    "mTxnType": "",
    "mAmount": 4150,
    "mStmtType": "",
    "mReferenceNo": "",
    "mDescription": "",
    "mTermsDate": "Dec 15, 2013 12:00:00 AM",
    "mShipTo": "",
    "mProperty1": "",
    "mProperty2": "",
    "mOrderType": "",
    "SuppProcessStatus": "",
    "mForeignTable": "",
    "mForeignKey": 0,
    "mDefaultRowsNumber": 15,
    "incoterms": "",
    "permitNo": "",
    "permitDoc1": "",
    "permitDoc2": "",
    "permitDoc3": "",
    "txnDoc1": "",
    "txnDoc2": "",
    "txnDoc3": "",
    "transportDoc1": "",
    "transportDoc2": "",
    "transportDoc3": "",
    "transportDate": "Jan 1, 0001 12:00:00 AM",
    "tradersRemarks": "",
    "requestedDate": "Nov 15, 2013 5:56:23 PM",
    "remarks2": "",
    "whtTaxType": "",
    "whtTaxCode": "",
    "whtTaxRate": 0,
    "whtTaxAmount": 0,
    "whtTaxBalance": 0,
    "whtFilingDate": "Jan 1, 0001 12:00:00 AM",
    "whtFilingCycle": "",
    "label_id": 0,
    "groupDiscount": 0,
    "tax_id": "",
    "vecPurchaseOrderItems": []
}

ITEM

Item contains detail of PO items. To create a PO it must have at lease 1 item data.

Sample json data of PO Item Object

{
    "mPkid": 1829,
    "mGuid": "",
    "mIndexGuid": "",
    "mPurchaseOrderId": 1228,
    "mPurchaseItemId": 0,
    "mRemarks": "",
    "mTotalQty": 2,
    "mCurrency": "MYR",
    "mUnitPriceRecommended": 500,
    "mUnitPriceQuoted": 405,
    "mStatus": "active",
    "mPurchaseItemType": "inv",
    "mItemId": 1007,
    "mStkCode": "ATL4251320K",
    "mBarCode": "",
    "mSerialized": true,
    "mName": "1/2\"x3/8\"x16TPI T-SLOT MACHINE CLAMP SET",
    "mOutstandingQty": 0,
    "mPriceList": 0,
    "mPriceSale": 0,
    "mPriceDisc1": 0,
    "mPriceDisc2": 0,
    "mPriceDisc3": 0,
    "mPriceMin": 0,
    "mFifoUnitCost": 0,
    "mMaUnitCost": 0,
    "mWaUnitCost": 0,
    "mLastUnitCost": 0,
    "mReplacementCost": 0,
    "mReceivingPrice": 450,
    "mReceivingStatus": "",
    "mReceivingQty": 2,
    "mReceivingRemarks": "",
    "colSerial": [],
    "colSerialObj": [],
    "mDescription1": "",
    "mDescription2": "",
    "mUnitPriceQuoted3": 0,
    "mImage": 0,
    "whtTaxType": "",
    "whtTaxCode": "",
    "whtTaxRate": 0,
    "whtTaxAmount": 0,
    "whtTaxBalance": 0,
    "whtFilingDate": "Jan 1, 0001 12:00:00 AM",
    "whtFilingCycle": "",
    "vecSerialNumberDelta": [],
    "mBomId": 0,
    "mPackageGroup": "",
    "mCurrency2": "",
    "mUnitPriceQuoted2": 0,
    "mStockReqId": 0,
    "taxCode": "",
    "taxType": "",
    "taxRate": 0,
    "taxAmt": 0,
    "taxAmt2": 0,
    "mUnitPriceRecommended2": 0,
    "taxOption": "",
    "uom": "EA",
    "uomRatio": 0,
    "date_expected_delivery": "Nov 16, 2013 12:00:00 AM",
    "codeProject": "",
    "codeDepartment": "",
    "vecLabels": [],
    "label_id": 0,
    "remoteStatus": "",
    "unitDiscount": 0,
    "unitDiscount2": 0,
    "vecDiscountElement": []
}

To create Purchase Order need to pass above parameters. Purchase Order will be created in server side after some validation.

Example Request

    String responsejson = "";
    String userName = "something";
    String password = "something";
    String poJson = getJsonData(); //This is an user defined function which will provide formatted json data of Request object

    String urlParam="userName="+ URLEncoder.encode(userName,"UTF-8")+"&password=" 
                + URLEncoder.encode(password,"UTF-8")+"" +
                "&poJson="+URLEncoder.encode(poJson,"UTF-8");

    String urlStr = "http://cloud.wavelet.biz/demo/ws/api/purchase_order/createPO"; 

    URL url = new URL(urlStr);

    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("POST");

    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    con.setDoOutput(true);
    con.setFixedLengthStreamingMode(urlParam.getBytes().length);

    if (con != null) 
        {
        java.io.OutputStream os = con.getOutputStream();
        os.write(urlParam.getBytes());

        BufferedReader rd  = new BufferedReader(new InputStreamReader(con.getInputStream()));
        responsejson = rd.readLine();
    }

    if(con != null) { con.disconnect(); }

Response from Server

If user validation is true and the ACTION request was successful then the response data will be as follow:

{
    "userValidation": true,
    "resultJSON": "true",
    "msgCode": 0,
    "msg": "2014-02-13 01:51:10.0" 
}

If user is not being validated then the response data will be as follow:

{
    "userValidation": false,
    "resultJSON": "",
    "msgCode": 0,
    "msg": "2014-02-13 01:51:10.0" 
}

If user validation is true but the ACTION request wasn't successful then the response data will be as follow:

{
    "userValidation": true,
    "resultJSON": "false",
    "msgCode": 0,
    "msg": "2014-02-13 01:51:10.0" 
}

Private & Confidential