GatewayScript Hello World

GatewayScript Hello World

It is surprisingly difficult to find in the documentation of IBM API Connect how to write a Hello World in GatewayScript. As every time I do a demo to a customer, I usually create an API from scratch, it is not uncommon for me to end writing a Hello World as a response for the API.

All you need is this code snippet. You can add any properties to the object 'response' to suit your needs:

var response = {};
response.output = 'Hello World';
session.output.write(response);
apim.output('application/json');
 
  

Just place that code in a GatewayScript policy:


And that's all. Once you add that API in a Product and that product is published in a catalogue, you can invoke to your API. You will get this output:

{
output"Hello World"
}

I hope this code snippet is useful to you as well.



要查看或添加评论,请登录

Jose Ramon Huerga Ayuso的更多文章

  • PSD2 - Detection of consecutive errors

    PSD2 - Detection of consecutive errors

    According to Article 33(1) of the RTS of EBA, ASPSP should calculate if there are five consecutive unsuccessful…

  • APIdays Paris 2018 - Conference Summary

    APIdays Paris 2018 - Conference Summary

    This week I attended the APIDays conference in Paris. With five tracks and two workshop rooms running during the two…

    3 条评论
  • Installing Ubuntu 18.04 on a Lenovo 100S

    Installing Ubuntu 18.04 on a Lenovo 100S

    Recently a friend purchased a Lenovo IdeaPad 100S and asked me to install Ubuntu on his laptop, as its tiny hard drive…

  • OpenAPI 3.0 - New interesting features

    OpenAPI 3.0 - New interesting features

    Recently, the OAI (a consortium formed by companies such as MuleSoft, Software AG, IBM, Salesforce, etc) has released…

    2 条评论
  • El 50% de los CRMs ya están en la nube

    El 50% de los CRMs ya están en la nube

    Recientemente la empresa SoftDoit ha publicado su estudio anual sobre herramientas de marketing y ventas y el uso de…

  • Salesforce Essentials - Resumen de la sesión

    Salesforce Essentials - Resumen de la sesión

    El miércoles pasado, más de 2.000 personas se dieron cita en el Salesforce Essentials Madrid.

    1 条评论
  • Usando Salesforce para resolver problemas reales

    Usando Salesforce para resolver problemas reales

    Es muy posible que la mayor de los profesionales TI asocien a Salesforce como una marca muy vinculada al CRM en cloud…

  • Introduccion a Heroku

    Introduccion a Heroku

    La semana pasada se celebró un nuevo meetup del Madrid Salesforce Developer Group. Si eres desarrollador, arquitecto…

    1 条评论
  • Apúntate al meetup de Salesforce de esta semana

    Apúntate al meetup de Salesforce de esta semana

    Si no lo has hecho ya y no tienes planes para este viernes 1 de abril a las 18h, te recomiendo que te acerques al…

  • Cómo aprobar el examen Salesforce Sales Consultant

    Cómo aprobar el examen Salesforce Sales Consultant

    Esta semana he aprobado el examen de certificación Salesforce Sales Consultant, complementando así la certificación que…

    4 条评论

社区洞察

其他会员也浏览了