Skip to Content
Technical Articles
Author's profile photo Ashish Kumar Singh

Passing “x-www-form-urlencoded” body format data in REST API via ABSL

The purpose of this document to explain how to pass on the “x-www-form-urlencoded” format data in a REST API using ABSL programming.

 

  • First let us try to see how we pass “x-www-form-urlencoded” kind of data via Postman tool.

P.S. It is an example URL. Each API has it’s own specific way of being consumed. 

 

a) Maintain the URL for which the operation needs to be performed as shown in the below screen shot.

Also choose the type of operation (GET/POST/PATCH/PUT) as per the guidelines of the API being used, along with the authorization

 

 

b) Move on to the Body tab and select the “”x-www-form-urlencoded” radio button.

By default screen display a Key & Value tabular view to maintain the required Data. User may wish to change the view by clicking on the “Bulk Edit” option on the right corner.

 

 

c) Once all required parameters and values w.r.t. API is maintained, you can click on “Send” to view the response.

 

 

  • Now let us try to replicate the similar process via ABSL code in SDK (C4C – Sales and Service Cloud)

 

a) Create an External Web Service Integration Object

 

b) Click on Next and Choose the Web Service Type as “Rest”.

 

 

c) Click on Next and provide the URL.

 

 

d) Select “Create Communication Scenario” check box and provide the name for the same. 

 

 

e) Click Next and Finish. Activate the .wsid and .csd files. 

 

f) Create the communication arrangement for the above created communication scenario definition. 

 

Move to the Communication Arrangement section and Choose New as highlighted Below.

 

 

Choose the respective communication system for this arrangement.

 

Maintain the Credentials required for this arrangement.

 

In order to update the endpoint url of the API, click on the “Edit Advanced Settings” option as highlighted below.

 

Maintain the endpoint path in the highlighted field.

 

Click Next and Finish the Activation process for the arrangement.

g)Once the communication arrangement is available, Enhance the ABSL script where you wish to implement the code.

h) Below is the code snippet, showing how you should pass the data in the body for the format “x-www-form-urlencoded“.

 

You need to pass the Key and Value pair separated via “&” (ampersand). 

The key & value pair is similar to how we passed data in Postman in a tabular view.

 

Once all the settings and code are placed, you would be able to establish the connection and receive the response from the target system.

 

 

 

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Pratik Shekokar
      Pratik Shekokar

      Hello Ashish,

      We have implemented a web service (REST API using PUT operation) to update the service ticket data in external system.

      The data in body is also in key value paired and in dynamic format. We have pass the data in body with "application/x-www-form-urlencoded" as content type var body = "id=".Concatenate(TicketComp.ID.content).Concatenate("&Type=").Concatenate(TickeType).Concatenate("&product=").Concatenate(productname).Concatenate("&IBase=").Concatenate(Installedbase).Concatenate("&record=").Concatenate(Description).Concatenate("&SCategory=").Concatenate(ServiceCategory).Concatenate("&ICategory=").Concatenate(ICategory).Concatenate("&CCategory=").Concatenate(CauseCategory).Concatenate("&date=").Concatenate(RequestedStartDateString).Concatenate("&Time=").Concatenate(WorkDurationString).Concatenate("&PTicketID=").Concatenate(ParentTicketID); \

      only the ticket id is updating in external system ( HANA DB) but using postman all the values are updating which we are passing through body.

      Is put method supports to “application/x-www-form-urlencoded” this content type or not.

      Please help

      Author's profile photo Joseph Eltoukhy
      Joseph Eltoukhy

      I am having the same problem it only sees the first parameter. any solution??

      Author's profile photo Mohammad Salmani
      Mohammad Salmani

      Please use following function, it will work:

      WebServiceUtilities.ExecuteRESTServiceWithoutEncoding