5 Replies Latest reply on Aug 28, 2015 7:17 AM by DanielShanahan

    SlideRoom API

    DanielShanahan

      Has anyone worked with the API for SlideRoom?

        • 1. Re: SlideRoom API
          ibrahim_bittar

          I didn't, but I see that all communication is based on REST and JSON, so you may find useful to use Base Elements Plugin, which has a function to parse JSON responses.

          • 2. Re: SlideRoom API
            DanielShanahan

            Thanks Ibrahim.  Have you worked with other APIs?

            • 3. Re: SlideRoom API
              ibrahim_bittar

              Yes, I've worked with FreshDesk to create support tickets from FileMaker Pro.

               

              The API is structurally the same. You send a request using "Insert from URL" and get a JSON response, which you can parse using BaseElements Plugin.

               

              The most complicated part is two factor authentication. To be honest, I don't totally get it yet .

              • 4. Re: SlideRoom API
                DanielShanahan

                Thanks Ibrahim.

                • 5. Re: SlideRoom API
                  DanielShanahan

                  Well, I'm not the brightest bulb in the chandelier.  It took me a while to figure this out.  Since I'm sure to forget what I've learned, and in case anyone else is new to parsing JSON with the Base Elements plugin, here is what I did:

                   

                  1. I have a field that returns a result in JSON. I'll refer to this field as TABLE::jsonResult

                  2. The result is a simple key/value pair; no arrays.

                   

                  The result looks like this:

                   

                  {"sid": "SM4•••••••••••e6a", "date_created": "Mon, 24 Aug 2015 19:53:55 +0000", "date_updated": "Mon, 24 Aug 2015 19:53:55 +0000", "date_sent": null, "account_sid": "AC69d71c346eec09d28e68afb845005a96", "to": "+15555551234”, "from": "+15555551235”, "body": “Lorem Ipsum.”, "status": "queued", "num_segments": "2", "num_media": "0", "direction": "outbound-api", "api_version": "2010-04-01", "price": null, "price_unit": "USD", "error_code": null, "error_message": null, "uri": "/2010-04-01/Accounts/AC6•••••••••••6/Messages/SM4•••••••••••e6a.json", "subresource_uris": {"media": "/2010-04-01/Accounts/AC6•••••••••••6/Messages/SM4•••••••••••e6a.json”}}

                   

                  To retrieve the date_created, I would call this function:

                   

                  BE_JSONPath ( TABLE::jsonResult ; "$.date_created" )

                  which returns Mon, 24 Aug 2015 19:53:55 +0000

                   

                  I think it is good to test with a value that exists.  I'm looking for any errors that may have occurred, so I called the function with the "error_code" parameter like so

                   

                  BE_JSONPath ( TABLE::jsonResult ; "$.error_code" )


                  It didn't return anything, which makes sense, but I was expecting it to return "null"  (again, not the brightest bulb...).  That's why I think it may be good to test with a value that exists.


                  Here is the documentation on BE_JSONPath


                  Thanks again, Ibrahim.