137
Views
3
Comments
Solved
Changing/replacing  structure of a consumed Api

Hi Everyone,


I have a 'structure' created using the Json data of the API. With the json response structure i was able to create mock data for my screens. Now i am consuming my real Api. While consuming the Consumed Api is creating a new structure. Although the structure attributes are same. now i have two structures with samew attributes. I need to make sure that the consumed Api has the same structure since i have used the same for the parameters in  my screen. Could any one please help.

Created for the mock data 


Created automatically once the api was consumed



2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Saif,

You have two choices here. The first is delete your structure, and rename the automatically created structure to the same name as your initial structure had. TrueChange should be able to fix the errors. The second option, which may be the best depending on your module architecture, is to keep your structure and convert the REST structure to your structure, via an interface action (so you call that action from your code instead of the REST method directly).

UserImage.jpg
vikas sharma
Champion

Hi,

so for this simply you can change the datatype of API response. In API method for output response change the datatype to the structure created by you instead created by OutSystems automatically. Once done can delete the response structure created by OutSystems.

regards

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Vikas,

This is not possible, unless you put the structure you created in the folder that Service Studio has created for the REST (and, unfortunately, due to limitations in SS, you can't copy/paste structures there).

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Saif,

You have two choices here. The first is delete your structure, and rename the automatically created structure to the same name as your initial structure had. TrueChange should be able to fix the errors. The second option, which may be the best depending on your module architecture, is to keep your structure and convert the REST structure to your structure, via an interface action (so you call that action from your code instead of the REST method directly).

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.