Logo Rest servisi, data nesnelerini (muhasebe hesap kartı, malzeme kartı, sipariş fişi vb. kart ve fişlerin her birine data nesnesi diyoruz) veri bütünlüğünü bozmadan veri tabanına aktarabilmektedir. İlk konuda bahsettiğimiz gibi, herhangi bir işlem öncesinde elimizde geçerli "accessToken" bilgisi bulunmalıdır. Dolayısıyla bu sayfada anlatılanların çalışabilmesi için öncelikle ilk adımda anlatılan işlemlerin başarılı olması gerekmektedir.
Aşağıdaki örnek JSON formatında hazırlanmış bir sipariş fişinin POST örneğidir.
string orderSlip = "{"
+ " \"INTERNAL_REFERENCE\": 0,"
+ " \"NUMBER\": \"~\","
+ " \"DATE\": \"02.05.2016\","
+ " \"TIME\": 102581337,"
+ " \"ARP_CODE\": \"CARI.01\","
+ " \"CURRSEL_TOTAL\": 1,"
+ " \"TRANSACTIONS\": {"
+ " \"items\": ["
+ " {"
+ " \"TYPE\": 0,"
+ " \"MASTER_CODE\": \"MALZEME.02\","
+ " \"QUANTITY\": 5,"
+ " \"PRICE\": 10,"
+ " \"VAT_RATE\": 18,"
+ " \"UNIT_CODE\": \"ADET\","
+ " \"UNIT_CONV1\": 1,"
+ " \"UNIT_CONV2\": 1,"
+ " \"EDT_CURR\": 1"
+ " }"
+ " ]"
+ " }"
+ "}";
resp = HttpPost("http://172.16.57.114:32001/api/v1/salesOrders", orderSlip, accessToken);
Bazı değerler POST işlemi esnasında oluşmaktadır. Örneğin yukarıdaki kod içerisinde NUMBER = ~ şeklinde belirtilmiştir. Bu, aslında sisteme gönderilen bir komuttur ve "numaralandırma şablonuna göre sıradaki numarayı kullan" demektir. Tilda (~) işareti sistem tarafından işlenerek POST işlemi esnasında bir numara üretilir ve ilgili fiş bu numara kullanılarak veritabanına yazılır. Bazı projelerde bu POST esnasında oluşturulan bilgilere de ihtiyaç duyulmaktadır. Rest Servis ile bu bilgilere ulaşabiliriz. Örnekteki resp değişkeninin içeriği (eğer post işleminde herhangi bir hata alınmamış ve fiş düzgün biçimde veritabanına yazılmış ise) aşağıdaki JSON formatında olacaktır.
{
"INTERNAL_REFERENCE":735,
"NUMBER":"~",
"DATE":"2016-02-05T00:00:00",
"TIME":102581337,
"ARP_CODE":"CARI.01",
"CURRSEL_TOTAL":1,
"TRANSACTIONS":
{
"items":[
{
"INTERNAL_REFERENCE":null,
"TYPE":0,
"MASTER_CODE":"MALZEME.02",
"QUANTITY":5.0,
"PRICE":10.0,
"VAT_RATE":18.0,
"UNIT_CODE":"ADET",
"UNIT_CONV1":1.0,
"UNIT_CONV2":1.0,
"EDT_CURR":1
}]
}
}
Dikkat ederseniz INTERNAL_REFERENCE değeri dolu gelmektedir. Kayıtla ilgili bilgilere ulaşabilmeniz için bu referans bilgisini kullanarak GET işlemi yapmalısınız.
resp = HttpGet("http://172.16.57.114:32001/api/v1/salesOrders/735?expandLevel=full", accessToken);
GET işlemi size aşağıdaki sonucu dönecektir.
{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
},
"INTERNAL_REFERENCE":735,
"TYPE":1,
"NUMBER":"0000000000000775",
"DATE":"2016-02-05T00:00:00",
"TIME":102581337,
"ARP_CODE":"CARI.01",
"CLIENTREF":2,
"RECVREF":0,
"ACCOUNTREF":0,
"CENTERREF":0,
"SOURCE_WH":0,
"SOURCE_COST_GRP":0,
"UPDCURR":0,
"ADD_DISCOUNTS":0.0,
"TOTAL_DISCOUNTS":0.0,
"TOTAL_DISCOUNTED":50.0,
"ADD_EXPENSES":0.0,
"TOTAL_EXPENSES":0.0,
"TOTAL_PROMOTIONS":0.0,
"TOTAL_VAT":9.0,
"TOTAL_GROSS":50.0,
"TOTAL_NET":59.0,
"RC_RATE":0.0,
"RC_NET":0.0,
"EXTENREF":0,
"PAYDEFREF":0,
"PRINT_COUNTER":0,
"DIVISION":0,
"DEPARTMENT":0,
"ORDER_STATUS":1,
"CREATED_BY":1,
"DATE_CREATED":"2016-10-05T00:00:00",
"HOUR_CREATED":16,
"MIN_CREATED":18,
"SEC_CREATED":20,
"MODIFIED_BY":0,
"DATE_MODIFIED":"1899-12-30T00:00:00",
"HOUR_MODIFIED":0,
"MIN_MODIFIED":0,
"SEC_MODIFIED":0,
"SALESMANREF":0,
"CURRSEL_TOTAL":1,
"CURRSEL_DETAILS":0,
"TEXTINC":0,
"DATA_SITEID":0,
"DATA_REFERENCE":735,
"FACTORY":0,
"TRANSACTIONS":{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/TRANSACTIONS",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
},
"items":[{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/TRANSACTIONS/2109",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
},
"INTERNAL_REFERENCE":2109,
"TYPE":0,
"MASTER_CODE":"MALZEME.02",
"STOCKREF":1002,
"ORDFICHEREF":735,
"CLIENTREF":2,
"PREVLINEREF":0,
"PREVLINENO":0,
"DETLINE":0,
"LINENO":1,
"SLIP_TYPE":1,
"DATE":"2016-02-05T00:00:00",
"TIME":102581337,
"DETAIL_LEVEL":0,
"CALC_TYPE":0,
"CENTERREF":0,
"ACCOUNTREF":0,
"VATACCREF":0,
"VATCENTERREF":0,
"PRACCREF":0,
"PRCENTERREF":0,
"PRVATACCREF":0,
"PRVATCENREF":0,
"PROMREF":0,
"QUANTITY":5.0,
"PRICE":10.0,
"TOTAL":50.0,
"QUANTITY_SHIPPED":0.0,
"DISCOUNT_RATE":0.0,
"COST_DISTR":0.0,
"DISCOUNT_DISTR":0.0,
"EXPENSE_DISTR":0.0,
"PROMOTION_DISTR":0.0,
"VAT_RATE":18.0,
"VAT_AMOUNT":9.0,
"VAT_BASE":50.0,
"UNIT_CODE":"ADET",
"UOMREF":23,
"USREF":5,
"UNIT_CONV1":1.0,
"UNIT_CONV2":1.0,
"UNIT_CONV3":0.0,
"UNIT_CONV4":0.0,
"UNIT_CONV5":0.0,
"UNIT_CONV6":0.0,
"UNIT_CONV7":0.0,
"UNIT_CONV8":0.0,
"VAT_INCLUDED":0,
"ORDER_CLOSED":0,
"ORDER_RESERVE":0,
"INUSE":0,
"DUE_DATE":"1899-12-30T00:00:00",
"CURR_PRICE":0,
"PC_PRICE":0.0,
"RC_XRATE":0.0,
"BILLED_ITEM":0,
"PAYDEFREF":0,
"EXTENREF":0,
"COMPOSITE":0,
"SOURCE_WH":0,
"SOURCE_COST_GRP":0,
"DIVISION":0,
"DEPARTMENT":0,
"TOTAL_NET":50.0,
"SALESMANREF":0,
"ORDER_STATUS":1,
"DREF":0,
"TRGFLAG":0,
"DATA_SITEID":0,
"DATA_REFERENCE":2109,
"FACTORY":0,
"NET_DSC_FLAG":0,
"NET_DSC_RATE":0.0,
"NET_DSC_AMOUNT":0.0,
"PRODUCED":0,
"DETAILS":{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/TRANSACTIONS/2109/DETAILS",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
}
},
"XML_ATTRIBUTE":2,
"REASON_FOR_NOT_SHP":0,
"CMPG_LINE_REF":0,
"CAMPAIGN_INFOS":{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/TRANSACTIONS/2109/CAMPAIGN_INFOS",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
},
"items":[{"Meta":{"href":"",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
},
"CAMPCODE1":null,
"CAMP_LN_NO":0
}
]
},
"CAMPAIGN_POINT":0.0,
"PR_RATE":0.0,
"GROSS_U_INFO1":0.0,
"GROSS_U_INFO2":0.0,
"CANCELLED":0,
"DEM_PEGGED_AMNT":0.0,
"TEXTINC":0,
"PROJECTREF":0,
"DEFNFLDS":{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/TRANSACTIONS/2109/DEFNFLDS",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
}
},
"CURR_TRANSACTIN":0,
"PRCLISTREF":0,
"AFFECT_COLLATRL":0,
"VARIANTREF":0,
"CANCONFIG":0,
"PRIORITY":0,
"ADD_TAX_RATE":0.0,
"ADD_TAX_CONVFACT":0.0,
"ADD_TAX_AMOUNT":0.0,
"ADD_TAX_ACCREF":0,
"ADD_TAX_CENTERREF":0,
"ADD_TAX_AMNTISUPD":0,
"ADD_TAX_DISC_AMOUNT":0.0,
"EX_ADD_TAX_RATE":0.0,
"EX_ADD_TAX_CONVF":0.0,
"EX_ADD_TAX_AMOUNT":0.0,
"EU_VAT_STATUS":0,
"ADD_TAX_EFFECT_KDV":0,
"AFFECT_RISK":1,
"EXCLINE_INTERNAL_REFERENCE":0,
"EXCLINE_TRANS_REF":0,
"EXCLINE_PRICE":0.0,
"EXCLINE_TOTAL":0.0,
"EXCLINE_DIST_COST":0.0,
"EXCLINE_DIST_DISC":0.0,
"EXCLINE_DIST_EXP":0.0,
"EXCLINE_DIST_PROM":0.0,
"EXCLINE_VAT_AMOUNT":0.0,
"EXCLINE_VAT_MATRAH":0.0,
"EXCLINE_LINE_NET":0.0,
"EXCLINE_DIST_ADD_EXP":0.0,
"EXCLINE_NET_DISC_AMOUNT":0.0,
"EXCLINE_VAT_CALC_DIFF":0.0,
"EXCLINE_EU_VAT_AMOUNT":0.0,
"EXCLINE_ADD_TAX_AMOUNT":0.0,
"EXCLINE_ADD_TAX_CONV_FACT":0.0,
"EXCLINE_ADD_TAX_DISC_AMOUNT":0.0,
"EXCLINE_EX_ADD_TAX_AMOUNT":0.0,
"EXCLINE_EX_ADD_TAX_CONVF":0.0,
"ADD_TAX_VAT_MATRAH":0.0,
"EXCLINE_ADD_TAX_VAT_MATRAH":0.0,
"EDT_PRICE":10.0,
"EDT_CURR":160,
"ORG_DUE_DATE":"1899-12-30T00:00:00",
"ORG_QUANTITY":0.0,
"ORG_PRICE":0.0,
"RESERVE_DATE":"1899-12-30T00:00:00",
"RESERVE_AMOUNT":0.0,
"PRCLISTTYPE":0,
"DEDUCTION_PART1":0,
"DEDUCTION_PART2":0,
"OFFERREF":0,
"OFFTRANSREF":0,
"GUID":"6B282AE1-F356-4F64-BF0E-69C52173A2E7"
}
]
},
"XCNT":0,
"XML_ATTRIBUTE":0,
"DLV_CLIENT":0,
"CANCELLED":0,
"OFFER_REFERENCE":0,
"OFFALT_REFERENCE":0,
"OFFER_TYP":0,
"OFFER_ALTNR":0,
"CURR_TRANSACTIN":0,
"TC_RATE":1.0,
"TC_NET":0.0,
"WITH_PAYMENT":0,
"PAYMENT_LIST":{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/PAYMENT_LIST",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
}
},
"PROJECTREF":0,
"DEFNFLDSLIST":{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/DEFNFLDSLIST",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
}
},
"WFLOWCARDREF":0,
"OP_STATUS":0,
"UPD_CURR":0,
"UPD_TRCURR":0,
"GUARANTOR1_FICHETYPE":0,
"GUARANTOR1_NR":0,
"GUARANTOR1_SITEID":0,
"GUARANTOR1_ORGLOGICREF":0,
"GUARANTOR1_CLIENTREF":0,
"GUARANTOR2_FICHETYPE":0,
"GUARANTOR2_NR":0,
"GUARANTOR2_SITEID":0,
"GUARANTOR2_ORGLOGICREF":0,
"GUARANTOR2_CLIENTREF":0,
"AFFECT_COLLATRL":0,
"DEMANDPEGGINGS":{"Meta":{"href":"http://172.16.57.114:32001/api/v1/salesOrders/735/DEMANDPEGGINGS",
"mediaType":"application/json; charset=UTF-8",
"apiVersion":"1.0"
}
},
"TOTAL_ADD_TAX":0.0,
"TOTAL_EX_ADD_TAX":0.0,
"AFFECT_RISK":1,
"EXCHINFO_INTERNAL_REFERENCE":0,
"EXCHINFO_FICHE_REF":0,
"EXCHINFO_ADD_DISCOUNTS":0.0,
"EXCHINFO_TOTAL_DISCOUNTS":0.0,
"EXCHINFO_TOTAL_DISCOUNTED":0.0,
"EXCHINFO_ADD_EXPENSES":0.0,
"EXCHINFO_TOTAL_EXPENSES":0.0,
"EXCHINFO_DIST_EXPENSE":0.0,
"EXCHINFO_TOTAL_DEPOZITO":0.0,
"EXCHINFO_TOTAL_PROMOTIONS":0.0,
"EXCHINFO_VAT_INC_GROSS":0.0,
"EXCHINFO_TOTAL_VAT":0.0,
"EXCHINFO_GROSS_TOTAL":0.0,
"EXCHINFO_TOTAL_ADD_TAX":0.0,
"EXCHINFO_TOTAL_EX_ADD_TAX":0.0,
"EXCHINFO_BAGKUR":0.0,
"EXCHINFO_STOPAJ":0.0,
"EXCHINFO_SSDF":0.0,
"EXCHINFO_BORSA":0.0,
"EXCHINFO_KOMISYON":0.0,
"EXCHINFO_KOM_KDV":0.0,
"EXCHINFO_EK1":0.0,
"EXCHINFO_EK2":0.0,
"EXCHINFO_EK3":0.0,
"EXCHINFO_EK4":0.0,
"EXCHINFO_EK5":0.0,
"PAYMENT_TYPE":0,
"APPROVE":0,
"APPROVE_DATE":"1899-12-30T00:00:00",
"GUID":"2AE81770-1165-4521-8C53-2791558EA039",
"DEDUCTIONPART1":2,
"DEDUCTIONPART2":3,
"CANCEL_AUTO_CAMP_PROC":0,
"APPLY_ARP_DISCOUNT":0
}