Is it possible to make the output of a custom extension a structure? For example, let's say I'm using some C# to make an API call to some service, and I want to have the output of that API call already in its standard structured JSON format as defined inside the C# project. Is it possible to make that the output instead of outputting it as text, and then deserializing it in the server action? Would it need to be a record type for the parameter? Does anyone know of any forge components that demonstrate this?
When you define the method in integration studio set the output parameter as ->
record list of structure
It will create a Out param of List<Structure> in C# code
Hi,
1. You can create a structure in the extension which will be having the same attributes present in your json output from API.
2. Now this structure will be available in your .net extension library
3. In your .net function where you are getting the json value from the API, there you can make the return type as List<newstructure>
4. Parse the JSON and fill up the list (type of newstructure) and return.
What is the output parameter type in this suggestion?
What's the difference between record and record list? If the API is known to always only return a single object, like: {"name": "Elon Musk", "role": "CEO", "age": 52} does it still have to be a record list even though it's one object?
If you know you will always return a single object, you can keep the output as a Record, not a Record List. Calling the API and processing the result are part of the implementation within your code.