Update Sales Order

Overview

Service Unique Name UpdateSalesOrder
Request Method POST
Content Type application/x-www-form-urlencoded; charset=utf-8

Description

API for updating sales order details using the Update Sales Order API. This API is used to update sales order or its cancellation. If sales invoice exists with this sales order then it will cancel the sales invoice also along with the sales order.

Request Header

AccessKey : logixerp

Request Body

These are form parameters:

  • salesOrderNumber: SO1574
  • cancel: true
  • shippingCity: delhi
  • shippingState: DLI
  • shippingCountry: IN
  • shippingPincode: 110096
  • shippingPhone: 1236547896
  • shippingAddress: Ashok Nagar
  • receiverName: xxxx

Request Details

Parameter Data Type Required/Optional Description
SecureKey int Required It is a Unique key for accessing the API. For secure key email to support team.
salesOrderNumber String Required It takes sales order number for which user wants to update the details.
cancel Boolean Optional It takes boolean value (true/false).If true then it will cancel the sales order.
shippingCity String Optional Receiver's city
shippingState String Optional Receiver's State.
shippingCountry String Optional Receiver's country.
shippingPincode String Optional Receiver's Pincode.
shippingPhone String Optional Receiver's Phone Number.
shippingAddress String Optional Receiver's Address.
receiverName String Optional Receiver's Name.

Response Format

ON SUCCESS
{
"message": "Sales order has been cancelled successfully.",
"messageType": "Success",
"salesOrderNumber": "SO1574"
}

ON ERROR
{
"message": "From OU not found",
"messageType" : "Error"
}

Error Message String

Error Messages Description

Sample Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.LinkedHashMap;

import java.util.Map;

public class UpdateSalesOrder {

private static final String ACCESS_KEY = "logixerp";
private static final String API_URL = "https://api.logixplatform.com/Rachna/webservice/v2/UpdateSalesOrder?secureKey=";
private static final int SECURE_KEY = SECURE KEY;
private static final String ACCESS_URL = API_URL+SECURE_KEY;

public static void main(String[] args) throws IOException {

URL url = new URL(ACCESS_URL);
Map params = new LinkedHashMap<>();
params.put("salesOrderNumber", "SO1574");
params.put("cancel", "true");
params.put("shippingCity", "");
params.put("shippingState", "");
params.put("shippingCountry", "");
params.put("shippingPincode", "");
params.put("shippingPhone", "");
params.put("shippingAddress", "");

params.put("receiverName", "");

StringBuilder postData = new StringBuilder();
for (Map.Entry param : params.entrySet()) {
if (postData.length() != 0) postData.append('&');
postData.append(URLEncoder.encode(param.getKey(), "UTF-8"));
postData.append('=');
postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));

}

byte[] postDataBytes = postData.toString().getBytes("UTF-8");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("AccessKey", ACCESS_KEY);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
conn.setDoOutput(true);
conn.getOutputStream().write(postDataBytes);
Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
StringBuilder data = new StringBuilder();
for (int c; (c = in.read()) >= 0;) {
data.append((char)c);
}
String intentData = data.toString();
System.out.println(intentData);
}

}

import requests

access_url = "https://api.logixplatform.com/Rachna/webservice/v2/UpdateSalesOrder"

params = {'SecureKey':'secure_key'}
headers={'AccessKey':'logixerp'}
payload = {
'salesOrderNumber': 'SO1574',
'cancel': 'true',
'shippingCity': '',
'shippingState': '',
'shippingCountry': '',
'shippingPincode': '',
'shippingPhone': '',
'shippingAddress': '',
'receiverName': ''

}

try:
r = requests.post(access_url, params=params, headers=headers, data=payload)
print (r.text)
except requests.exceptions.RequestException as err:
print (err)
please wait...