Make a c# .net framework web api that retrieves data from an ms crm, the name of the entity is alfa_shipmentorder, the names of the fields in the crm start with alfa_
CRMAccountId long Yes CustomerID of 
your corporate
PickupType Int Yes
0 client will give items 
himself to POS
1 to be picked up
RequestTypeId Int Yes
Request delivery 
type of package 
(returned or not)
Package Delivery = 1,
Reverse Logistic = 2
CustomerName String Yes
The receiver name 
who will receive 
the items
Max Length = 50
CustomerMobileNumber String Yes
The receiver 
mobile who will 
receive the items
Max Length = 15
Min Length = 10 
(numbers only)
SenderName String Yes
The person 
delegated by your 
corporate to send 
these items
Max Length = 50
SenderMobileNumber String Yes
The person 
delegated by your 
corporate to send 
these items
Max Length = 15
Min Length = 10 
(numbers only)
Items List<UPDSItem> Yes
List of UPDSItem
with address 
details of each one 
(from where and 
to where)
1.2.1. UPDSItem properties:
Property Name Type Mandatory Description Comment
ReferenceId String Yes
Your item identifier
Unique value per 
CRMAccountId Attribute
PaymentType int Yes
Cash on delivery or not
If PickupType = 0 
PaymentType must be = 1
1 paid
2 Cash on delivery
ContentPrice decimal Yes Price of the content Maxlength = 6
Decimal(8,3) 
ContentDescription String Yes Description of the content
UPDS Integration Services (APIs) Guide Page 7
Weight decimal Yes
decimal (8,3) in
GM Maximum 30 
KG
BoxLength int No Mandatory in case of Item 
Type is parcel only Centimetre (cm)
BoxWidth int No Mandatory in case of Item 
Type is parcel only Centimetre (cm)
BoxHeight int No Mandatory in case of Item 
Type is parcel only Centimetre (cm)
DeliveryCost decimal No decimal(8,3) cost of delivery 
cost in SAR
maximum is 
99999.999
TotalAmount decimal Conditional
Mandatory if 
PaymentType = 2
decimal(8,3)
Total amount of 
COD in SAR, 
maximum is 
99999.999
SenderAddressDetail object Yes Object of 
ItemCustomerDetails
Where to pick 
from
Review 1.2.2
ReceiverAddressDetail object Yes Object of 
ItemCustomerDetails
Where to deliver
Review 1.2.2
PiecesCount int No
Number of pieces in the 
same item which related to 
each other
mandatory when 
you send data in 
ItemPieces List
ItemPieces List<ItemPiece> No list of pieces related to the 
item
mandatory when 
you send data in 
PiecesCount and 
ItemPieces list 
count should be 
(PiecesCount - 1)
UPDS Integration Services (APIs) Guide Page 8
1.2.2. ItemCustomerDetails properties: (Address details of (from) and (to))
Property Name Type Mandatory Description Comment
AddressTypeID string Yes
1- NationalAddress = 2 
ParcelStation = 3
Office = 4 
InternationalAddress=5 
InternalDescriptive = 6 
MapCoordinates = 7
ShortAddress = 10
For required fields per 
AddressType
Latitude string Conditional
Longitude string Conditional
BuildingNo int Conditional
Building Number 
Mandatory if
AddressTypeID = 2
Must be 4 numbers
UnitNo int Conditional
Unit Number
Mandatory if 
AddressTypeID = 2
Max = 4 numbers
AdditionalNo int Conditional
Additional Number
Mandatory if 
AddressTypeID = 2
Must be 4 numbers
ZipCode int Conditional
Zip Code 
Mandatory if 
AddressTypeID = 2
Must be 5 numbers
FinalOfficeID int Conditional Mandatory If
AddressTypeID = 3 or 4 
API: 
Address Type = Office: 
[URL]/ServiceProvider/GetPostalO
fficeByCity
Address Type = Parcel Station:
[URL]/ServiceProvider/GetParcelSt
ationByCity
LocationId string Yes City ID API: [URL]/GIS/GetCitiesByRegion
DistrictID Int No District ID API: [URL]/GIS/GetDistricts
AddressLine1 string Conditional Mandatory if
AddressTypeID = 6 Max = 100
AddressLine2 string Conditional Mandatory if
AddressTypeID = 6 Max = 100
CountryID int Conditional Mandatory if 
AddressTypeID = 5 API: [URL]/Location/GetCountries
ShortAddress String Conditional Mandatory if 
AddressTypeID = 10
DistributionDirectorateId Int Optional Posta distribution point ID
UPDS Integration Services (APIs) Guide Page 9
1.2.3. ItemPiece properties:
Property Name Type Mandatory Description Comment
PieceWeight decimal Yes Piece weight must be greater than 0 and less than 
or equal 30 
PiecePrice decimal No Piece price can’t be negative number
decimal (8,3)
PieceBarcode string No Barcode of piece will be filled 
in the response don’t set it.
PieceDescription string Yes Piece description PieceDescription is required and must 
be less than 500 charachter
1.3. Output Response
Property Name Type Mandatory Description Comment
Items List Yes List of UPDSItemResponse
Status Int Yes 1 success 2 an error occurred
Message String Yes success or an error occurred
1.3.1. UPDSItemResponse properties:
Property Name Type Mandatory Description Comment
ReferenceId string Yes
ItemStatus int Yes 1 success else types of errors
Message string Yes
Barcode string Yes
1.3.2. Address Types for the Sender with the required fields
AddressTypeID AddressTypeName Required Fields
2 National Address
BuildingNo
UnitNo
AdditionalNo
ZipCode
UPDS Integration Services (APIs) Guide Page 10
LocationID
3 Parcel Station
FinalOfficeID
LocationID
4 Office
FinalOfficeID
LocationID
6 InternalDescriptive
AddressLine1
AddressLine2
LocationID
7 MapCoordinates
Latitude
Longitude
LocationID
1.3.3. Address Types for the Receiver with the required fields
AddressTypeID AddressTypeName Required Fields
2 National Address
BuildingNo
UnitNo
AdditionalNo
ZipCode
LocationID
3 Parcel Station
FinalOfficeID
LocationID
4 Office
FinalOfficeID
LocationID
6 InternalDescriptive
AddressLine1
AddressLine2
LocationID
7 MapCoordinates
Latitude
Longitude
LocationID
5 InternationalAddress
AddressLine1
AddressLine2
CountryID
UPDS Integration Services (APIs) Guide Page 11
10 Short Address ShortAddress
1.3.4. Message Validations
Status Message
0 Unfortunately, Number of valid items is 0
1 success
2 an error occurred
3 invalid object
4 No items sent
5 property is required
6 property length is more than max length
7 mail syntax error
8
mobile syntax error
enter valid mobile number: numerical, maximum 15 and minimum 10
9 Pick Type should be 0 for POS or 1 for getting Picked by System
10 failure to commit valid items
11 N items accepted and committed out of N, [N Failed N Already Exists N are invalid]
12 Invalid CRMAccountID: Unregistered Client CRM Account ID
13 Invalid CRMAccountID: inactivated Client Request Account
ItemStatus Message
1 Success
4 Customer locationId Unrecognized
5 Sender OfficeId Unrecognized
5 Country Id is required with External Items
5 Country Id should not be 21 for External items
5 Decimal value has max length 3 digit after point
5 ZipCode is required and length should be 5
5 BuildingNumber is required and length should be 4
5 AdditionalNumber is required and length should be 4
5 UnitNumber is required with maximum length 4
5 OfficeID is required
5 AddressLine1 is required with max length 100
5 AddressLine2 is required with max length 100
5 Sender address cannot be International
UPDS Integration Services (APIs) Guide Page 12
5 LocationID is required
5 Item ReferenceId is null(required) or Duplicated among same Request
5 Item Weight range must be more than 0 and maximum is 30 kg
5 Item RequestAccountCustomerDetail is null(required)
5
Item.RequestAccountCustomerDetail.AddressTypeId:NationalAddress = 2, ParcelStation = 
3, Office = 4, InternalDescriptive = 6
5 Item.ItemCustomerDetail is null (required)
5
Item.ItemCustomerDetail.AddressTypeID:NationalAddress = 2, ParcelStation = 3, Office = 
4, InternationalAddress = 5, InternalDescriptive = 6
5 Payment Type should be 1 for Paid or 2 for CashOnDelivery
5 suspended temporarily
5 Payment type Cash on delivery not allowed with external Item
5 Payment type Cash on delivery not allowed with POS Items
5 Latitude is required with max length 50
5 Longitude is required with max length 50
5 Item referenceId is null(required) or Duplicated among same Request
5 ItemBarcode is required (if store is allowed to in setting)
5
ItemBarcode does not match the barcode store pattern (if store is allowed to pass 
barcode)
5 ItemBarcode duplicated among the request (if store is allowed to pass barcode in setting)
5
Sending a predefined barcode is not allowed with external item (if store is allowed to 
pass)
5 (Return denied) Item.ReceiverAddressDetail.AddressTypeId : NationalAddress = 2
5 (Return denied) Item.SenderAddressDetail.AddressTypeId: Office = 4
6 Item ContentPriceVAT maximum length is 99999.999
6 Item DeliveryCost maximum length is 99999.999
6 Item DeliveryCostVAT maximum length is 99999.999
6 Item TotalAmount maximum length is 99999.999
6 Item CustomerVAT maximum length is 99999.999
6 Item SaudiPostVAT maximum length is 99999.999
6 Receiver OfficeId Unrecognized
8 Receiver locationId Unrecognized
9 Duplicate Referenceid, succeeded for same CRMAccountId before.
10 Receiver Country locationId Unrecognized
11 Receiver OfficeId type is not parcel station
12 Sender OfficeId type is not parcel station
13 Receiver OfficeId(parcel) does not belong to Receiver location id
14 Sender OfficeId(parcel) does not belong to Sender location id
15 Sender OfficeId with addressTypeID = 4 shouldn’t be parcel station
UPDS Integration Services (APIs) Guide Page 13
16 Receiver OfficeId with addressTypeID = 4 shouldn’t be parcel station
17 Sender OfficeId(Office) does not belong to Sender location id
18 Receiver OfficeId(Office) does not belong to Receiver location id
19 Item Couldnot be inserted at PreAdvice (MsgCode: "MsgCode", MsgDesc: "MsgDesc")
32 (Return denied) Receiver national address doesn't match with account national address.
UPDS Integration Services (APIs) Guide Page 14
1.4. Example
Request payload
{
 "CRMAccountId": 123456,
 "PickupType": 1,
 "RequestTypeId": 1,
 "CustomerName": "Customer Name",
 "CustomerMobileNumber": "0543941021",
 "SenderName": "Sender Name",
 "SenderMobileNumber": "0543941021",
 "Items": [{
 "ReferenceId": "1234",
 "PaymentType": 1,
 "ContentPrice": 123.123,
 "ContentDescription": "No Description",
 "Weight": 11.25,
 "BoxLength": 10.56,
 "BoxWidth": 12.44,
 "BoxHeight": 13.3,
 "DeliveryCost": 10,
 "TotalAmount": 123.132,
 "SenderAddressDetail": {
 "AddressTypeID": 2,
 "LocationId": 3,
 "buildingNo": 3957,
 "unitNo": 1,
 "additionalNo": 7414,
 "zipCode": 13253,
 },
 "ReceiverAddressDetail": {
 "AddressTypeID": 6,
 "LocationId": 3,
 "AddressLine1": "sample string 10",
 "AddressLine2": "sample string 11",
 “DistrictId”:540
 }
 }]
}
UPDS Integration Services (APIs) Guide Page 15
Response
{
"Items": [{
 "ReferenceId": "1234",
 "ItemStatus": 1,
 "Message": "Success",
"Barcode": "CRDSAL0000117419",
"ItemPiecesResponse": null
 }],
"Status": 11,
"Message": "Success"
}
1.4.1. Address Details Example
NationalAddress "ReceiverAddressDetail": {
 "AddressTypeID": 2,
 "BuildingNo": 4000,
 "UnitNo": 20,
 "AdditionalNo": 3000,
 "ZipCode": 12345,
 "LocationId": 3,
 }
InternalDescriptive "ReceiverAddressDetail": {
 "AddressTypeID": 6,
 "LocationId": 3,
 “DistrictId”: 540
 "AddressLine1": "sample string 10",
 "AddressLine2": "sample string 11",
 }
MapCoordinates "ReceiverAddressDetail": {
 "AddressTypeID": 7,
 "Latitude": "24.6544212",
 "Longitude": "48.254425",
 "LocationId": 3
 }
Office "ReceiverAddressDetail": {
 "AddressTypeID": 4,
 "LocationId": 3,
 "FinalOfficeID": 20300
 }
ParcelStation "ReceiverAddressDetail": {
 "AddressTypeID": 3,
 "LocationId": 1,
 "FinalOfficeID": 220723
 }
InternationalAddress "ReceiverAddressDetail": {
 "AddressTypeID": "5",
UPDS Integration Services (APIs) Guide Page 16
 "CountryID": 3,
 "AddressLine1": "sample string 10",
 "AddressLine2": "sample string 11"
 }
ShortAddress "ReceiverAddressDetail": {
 "AddressTypeID": 10,
 "ShortAddress": "RUMD3957"
 }