Software Archive
Read-only legacy content
17061 Discussions

Data Service how to - types of parameters

Geoff_at_CFM
Beginner
444 Views

I am creating a service for a data feed and I watched this video, which got me started...

software.intel.com/en-us/html5/videos/integrating-a-new-service

But all the data types used by Name Withheld are strings. My service is working OK if I declare all the parameters as strings, but...

Now I'd like to declare a datatype "Boolean", is there ANY documentation that shows how to do that, or should I just declare parameters as strings and fill them in from form selections?

        "parameters": [
          {
            "Name": "query",
            "Required": "N",
            "Default": "",
            "Type": "string",
            "Description": "Space separated list of filter words"
          },
          {
            "Name": "any_word",
            "Required": "N",
            "Default": "true/false",
            "Type": "boolean",
            "Description": "Search for any of the words"
          },
 

0 Kudos
7 Replies
PaulF_IntelCorp
Employee
444 Views

You're working with JSON data, which is always encoded as strings in order to maximize its portability. You need to convert the JSON data you receive into your preferred local format.

0 Kudos
Geoff_at_CFM
Beginner
444 Views

I think you're talking about something different?

I'm trying to define a service in the Intel XDK according to the instructions in the video I referenced. When defining a service the .json file uses parameters as shown above. If all parameters have a "type:" of "string", then why do I need a "type" parameter at all?

0 Kudos
Geoff_at_CFM
Beginner
444 Views

According to https://software.intel.com/en-us/xdk/docs/using-web-services.

Create the iodocs File - This file, named yourservice.json, describes all of the endpoints and APIs within the service. This file follows the format of iodocs from Mashery (see https://github.com/mashery/iodocs). This file is required for integration into the Intel XDK.

The layout according to mashery/docs should be...

                        "include_status": {
                            "title": "include_status",
                            "required": false,
                            "default": false,
                            "type": "boolean",
                            "description": "If true, status included."
                            "booleanValues": ["yes","no"]
                        },
 

This doesn't work in the Intel XDK for Boolean values.

0 Kudos
PaulF_IntelCorp
Employee
444 Views

Geoff -- sorry, I misunderstood the original question, I now understand what you are asking. I'll check with our local web services expert today and see what she says.

0 Kudos
PaulF_IntelCorp
Employee
444 Views

Geoff -- I've updated the doc page (https://software.intel.com/en-us/xdk/docs/using-web-services#specialparams) to answer your question and reflect the current state of that JSON file. In essence, that Boolean type is only needed by the web services UI, it does not impact how the web services JavaScript parses that data. Hope that answers your question, thanks for the heads up.

0 Kudos
Geoff_at_CFM
Beginner
444 Views

Thanks Paul, my point is that the web services UI isn't working for Boolean data types. If that isn't going to be fixed then there is no point defining a Boolean type, is there?

"ESPN": {
"name": "ESPN",
"description": "A great API",
"dashboardUrl": "http://developer.example.api",
"auth": "key",
"booleanTrueVal":"true",
"booleanFalseVal":"false"
}

​The example format for Boolean that you give at https://software.intel.com/en-us/xdk/docs/using-web-services#specialparams also doesn't work in the web services UI.

0 Kudos
PaulF_IntelCorp
Employee
444 Views

Thanks for the clarification, Geoff. Yes, I would recommend just using the enumerated type with two enumerations. The boolean is essentially just a subset of that. I'll inform the web services folks of the problem.

0 Kudos
Reply