Pass the Parameter / Variable in Http Request Body

Hi Team

I have a Json payload that needs to be place in http request body and now facing following challenges.

Tried to pass the Json payload directly in body but it’s thawing Compiler error.

Therefore, I put the json payload in Notepad file and then ready that file and save into a String variable. Now, I would like to pass the variable / parameter in that Json payload

Can someone please help me to pass the variable in the payload or pass the json payload in http request body?

Thanks
Naresh

@Naresh_Upadhyay,

Can you share how the json payload looks like and which value you are trying to replace by variable?

Here it is. I would like to replace legalEntity value.

{
“orderFrieghtAnalysis”:[
/{
“salesId”:“”,
“deliveryMode”:“UPS-Ex-P”,
“deliveryModeName”:“UPS Express Plus”,
“overrideCode”:“”,
“shippingAmt”:103.4,
“suggestedAmt”:103.4,
“shippingCost”:93.15,
“levelWeight”:2.58,
“custFreightAcct”:“”,
“overrideCodeDesc”:“”,
“levelName”:“01”,
“residentialChargeProposed”:0,
“outOfAreaChargeProposed”:0
}
/
],
“orderHeaderId”:“”,
“legalEntity”:“ZUKL”,
“currencyCode”:“USD”,
“companyName”:“AUTOMATION ZUKL TEST ACCOUNT”,
“aeId”:“e8e751a9-08d8-eb11-bacb-000d3a17efe1”,
“aeName”:“User 18756487351”,
“aMPersonalNumber”:“010900”,
“billingAddressId”:“1e46994a-6e59-ef11-bfe2-6045bda803e7”,
“accountId”:“02397cff-6859-ef11-a316-000d3a98c397”,
“accountBusinessUnit”:“800”,
“accountCostCenter”:“120099”,
“actionType”:188190002,
“customerAccount”:“2000003042”,
“customerRef”:“”,
“department”:“1200”,
“invoiceAmount”:“144.40”,
“isGamOrder”:true,
“justificationComments”:“”,
“justificationReason”:1,
“leasingAccountNumber”:“”,
“modifiedSource”:“OMS”,
“orderDate”:“”,
“orderLimit”:0,
“orderType”:188190000,
“paymentMode”:“OA”,
“purchOrderFormNum”:“vk_test”,
“expeditedFulfillment”:false,
“includedForCommission”:false,
“includeStandingEmailRecipients”:true,
“quoteExpirationDate”:“2024-09-30”,
“taxExemptionType”:“”,
“additionalEmails”:“”,
“soBuyer”:“”,
“futureReleaseDate”:“2024-09-22”,
“additionalShippingConfirmationEmails”:“”,
“giftReceipt”:false,
“manualMgrReviewFlag”:false,
“managerReview”:false,
“holdFulfillment”:false,
“quoteName”:“”,
“waitForCustomer”:false,
“onyxId”:“200004784”,
“isInterCompanySalesOrder”:false,
“salesId”:“”,
“brokerFeesType”:“Fixed”,
“markupTransheaders”:null,
“opportunityId”:“”,
“recId”:0,
“language”:“en-GB”,
“quoteStatus”:“”,
“zonOverrideFinancialDimension”:“No”,
“zonSuppressInvoice”:“No”,
“confirmationStatus”:“Yes”,
“billCompleted”:“No”,
“salesType”:“Journal”,
“salesOrigin”:“Assisted”,
“orderSource”:“CRM”,
“cIMSCustomerId”:“0”,
“cIMSProjectCode”:“”,
“cIMSProjectId”:“0”,
“cIMSProjectName”:“”,
“lastFourDigitCreditCardNumber”:“”,
“costTo”:“”,
“lOBCostcenter”:“”,
“lOBDepartment”:“”,
“miscData1”:“”,
“miscData2”:“”,
“miscData3”:“”,
“miscData4”:“”,
“miscData5”:“”,
“projectId”:“”,
“projectType”:“”,
“sendQuote”:null,
“loggedInUserId”:“693BC25D-6389-EE11-8179-6045BDD735D9”,
“isLimitedModified”:false,
“isUpdated”:false,
“deleteOrderLevelsIds”:[

],
“deleteOrderLinesIds”:[

],
“deleteCommentsIds”:[

],
“deleteOrderLineCommentsIds”:[

],
“deleteCustomizationNoteIds”:[

],
“deleteAttachDocumentIds”:[

],
“deleteOrderAssistsIds”:[

],
“deleteOrderFrieghtAnalysisIds”:[

],
“deleteOrderLineRecIds”:[

],
“deleteAssistRecIds”:[

],
“deleteCommentRecIds”:[

],
“orderLevels”:[
{
“orderLevelId”:“”,
“modifiedSource”:“OMS”,
“deliveryContactName”:“ZUKL CONTACT1”,
“deliveryContactPhone”:“+44 1214960497”,
“customerFreightAccount”:“”,
“overrideFreightAmount”:0,
“overrideFreightCharge”:false,
“shippingCost”:“93.15”,
“shippingMethodCode”:“UPS-Ex-P”,
“shippingMethodName”:“UPS Express Plus”,
“shippingRate”:“103.40”,
“shippingAmt”:“103.40”,
“isOverNight”:true,
deliveryEmail":"zuklc1@Test.com”,
“deliveryAddressLine”:“AUTOMATION ZUKL TEST ACCOUNT”,
“deliveryAddressStreet”:“CRAWLEY BUSINESS QUARTER MANOR ROYAL”,
“deliveryAddressCity”:“CRAWLEY”,
“deliveryAddressState”:“FN”,
“deliveryAddressCountry”:“GBR”,
“deliveryAddressZipCode”:“RH10 9AD”,
“shippingAddress”:“e91ed579-1d5e-ef11-bfe3-000d3a4ef5bd”,
“soLevel”:“01”,
“orderHeaderOrderLevelId”:“”,
“termsOfDeliveryCode”:“DDP”,
“termsOfDeliveryDescription”:“Delivered Duty Paid”,
“contactId”:“00e0c223-6959-ef11-a316-000d3a98c397”,
“holdToComplete”:false,
“orderLines”:[
{
“isLineModifiable”:true,
“orderLineComments”:[

           ],
           "orderLineId":"",
           "recId":0,
           "stopped":"No",
           "modifiedSource":"OMS",
           "itemId":"301134506",
           "productNumber":"301134506NEW",
           "dellQuoteId":"",
           "ceDellQuoteId":"",
           "dellQuoteExpiryDate":"1900-01-01",
           "primaryVendorId":"",
           "dellQuoteCost":0,
           "minPrice":39.38,
           "osrAmount":0,
           "itemName":"DELL Latitude 5440 Intel Core i5 i5-1345U Laptop",
           "name":"DELL Latitude 5440 Intel Core i5 i5-1345U Laptop",
           "configuration":"NEW",
           "customizationNoteCode":"SPDI",
           "customizationNoteReqd":0,
           "customizationNote":[
              {
                 "id":"",
                 "field":"MfrPartNumber",
                 "label":"Hold Number",
                 "fieldType":"string",
                 "controlType":"text",
                 "value":"",
                 "saleId":"",
                 "orderLineId":"",
                 "recId":0
        //
              },
              {
                 "id":"",
                 "field":"SpecialInstructions",
                 "label":"Special Instructions",
                 "fieldType":"string",
                 "controlType":"text",
                 "value":"",
                 "saleId":"",
                 "orderLineId":"",
                 "recId":0
        //
              },
              {
                 "id":"",
                 "field":"Description",
                 "label":"Case ID",
                 "fieldType":"string",
                 "controlType":"text",
                 "value":"",
                 "saleId":"",
                 "orderLineId":"",
                 "recId":0
        //
              }
           ],
           "mfrPartNumber":"5JC7R",
           "sku":"301134506-NEW",
           "manufacturerName":"DELL",
           "currencyCode":"USD",
           "weight":2.58,
           "wareHouse":"UKDSHIP",
           "site":"1",
           "recycleFeePrice":0,
           "recycleFeeReqd":false,
           "recycleFeeCode":"",
           "vpaPrice":41,
           "salesQty":1,
           "listPrice":44.62,
           "isWebStandard":0,
           "spa":"",
           "contractFee":"0",
           "contractID":"",
           "contractNumber":"",
           "internalContractName":"",
           "formalContractName":"",
           "salesPrice":41,
           "salesCost":39.38,
           "lineNumber":1,
           "appleDepLinkedItemId":0,
           "orderHeaderId":"",
           "orderLevelId":"",
           "displaySequence":1,
           "lineId":"",
           "landedCost":39.38,
           "landedCostPercent":0,
           "netLandedCost":"39.38",
           "webPrice":41,
           "needByDateQualifier":"0",
           "needByDate":null,
           "isFinishedGood":false,
           "isTSCService":false,
           "statusCode":0,
           "stateCode":0,
           "extCustProductNumber":"",
           "extPOLineNumber":"",
           "reviewQueue":"",
           "isInsideDelivery":0,
           "isLiftGateDelivery":0,
           "isProofRequireSignatureAdult":0,
           "isCustomerStandard":0,
           "wYType":0,
           "linkedWYLineNumber":0,
           "wYLineRefId":"",
           "deleteNoteRecIds":[
              
           ],
           "deleteLineCommentRecIds":[
              
           ],
           "bHConfigItem":"",
           "bAHItemId":"",
           "isBAHConfig":false,
           "isWsServiceItem":false,
           "lineStatus":"F1",
           "margin":"3.95"
        }
     ]
  }

]
}

@Naresh_Upadhyay,

Will the legal entity value going to be 4 character always?

Yes, 4 characters only.

@Naresh_Upadhyay,

Follow these steps:

  1. Deserialize JSON
    jObject = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Newtonsoft.Json.Linq.JObject)(strInputJSON)

  2. Assign new value to legalEntity
    jObject("legalEntity") = yourVariable

  3. Serialize JSON
    strJsonString = JsonConvert.SerializeObject(jObject)

Before:

After:

Sample Code:
Workflow1.xaml (15.7 KB)

Thanks,
Ashok :slight_smile:

@Naresh_Upadhyay

If you are using data from file then use a placeholder inplace of value and use replace

For example place holder can be <LegalEntity>

Then use str.Replace("<LegalEntity>",yourVariable) here str is the string read from Text file

Cheers