Wednesday, March 24, 2021

S3 rest service call to get key or object name using postman


Step1: Provide verb and rest URL

Verb: Get

URL format: https://buketname.s3.regionname.amazonaws.com/?QueryParameters

QueryParameters used:

list-type=2&prefix=filePath/&delimiter=/&query=Contents[?contains(key,' ')]


Step2: Choose type as aws signature and provide the follow information:

1. access key

2. secret key

3. AWS region: us-west-2(for example)

4. Service Name: s3

Step4: Run it.


OIC - Javascript - Replace String custom function

Usecase: If we use default replace string () function , what we observe that it does not allow to activate the integration. So we need to create a custom javascript function to replace a string with another one.

Here we will replace "_" with "/".

JS code:

function replaceString(value, str1,str2){

output = value.replace(new RegExp(str1, "g"), str2)

return output;

}

Implementation steps with screenshots:










OIC - Synchronous Integrations Occasionally Fail with a 504 Gateway Time-out Error

 Synchronous Integrations Occasionally Fail with a 504 Gateway Time-out Error


Synchronous integrations can fail with the following error.

    Bad response: 504 Gateway Time-out from url

    https://Instance_URL/Integration_Name/Version_Number/


This error occurs because synchronous integrations (integrations that return a response payload) are limited to 300 seconds and return a timeout error if they exceed that limit.

Optimize your integration and/or the endpoint you invoke to complete instance execution in under 300 seconds.


server limits:

server-Limits


Tuesday, March 23, 2021

OIC - JS - Return boolean status based on ERP result status

Requirement:

From ERP we are getting Import status as 'SUCCEEDED','WARNING','ERROR','CANCELED' and we need to convert it to boolean status like true or false.

JS code:

function returnStatus(result) {

 var inProgress;

  if (['SUCCEEDED','WARNING','ERROR','CANCELED'].indexOf(result)==-1)

  {

  inProgress = "true";

  }

  else

  {

  inProgress="false"

  }

  return inProgress;

}

Sunday, March 14, 2021

OIC - Javascript - to remove carriage return

For instance the method you made could be made more general to parse input from several different types of files. Due to differences in Operating system it is quite common to have files with \n or \r where a new line is required. To be able to handle both your code could be rewritten using some features of regular expressions. 

function removeCarriageReturn(variable){

var newString = "";

var newString =variable.replace(/[\n\r]/g, '');

return newString;

}



Wednesday, March 10, 2021

OIC - Use of Javascript in Integration | Add two numbers to keep fixed decimal positions

Usecase: Convert 2 numbers and rounding the numbers to keep only three decimals.

Step 1 : Create .js file and import in Libraries

add2NumbersTest.js

    function addTest(num1,num2){

    var newNum;

    var newNum2;

    newNum = parseFloat(num1) + parseFloat(num2);

    newNum2= newNum.toFixed(3)

    return newNum2;

    }

Import Navigation:

Integrations--Libraries--create--choose File --provide library name--create--select function--save







Step 2 : Create an Integration and use the javascript action and test it.

I have created a simple REST trigger connection and created an app driven Orchestration integration and in the REST trigger, I have added relative URL as /addTwoNums, Verb as POST, Configure following two options:

Configure a request payload for this endpoint

Configure this endpoint to receive the response

Input:

{

"num1":123.34567,

"num2":234.34455

}

choose Json as response payload type and  provide inline Json sample

{

"result": "234.56"

}

Add Javascript action and choose the created JS function. and map the two inputs with num1 and num2.

Last map the JS response with the output of the rest service.




















Add Tracking and test



Tuesday, March 9, 2021

Shell script to move files older than 10 days

A small script to move file from one directory to another.

step1: Create a file with name file_move.sh

    for i in $(find  absolute_path_from_move -type f -name "*"  -mtime +10 2> /dev/null);

    do

    mv $i archive_path;

    done

step2: execute with Command 

    sh -x file_move.sh

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...