Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ahmad_G_
Beginner
91 Views

Unable to create new web service

Hi,

I'm new to xdk, and I'm trying to create a new web service to talk to our website (RESTful) , however I can't get it to work. I followed the example in this video

https://software.intel.com/en-us/videos/integrating-a-new-service ;

but no luck. When I try the service it basically returns with a timeout. ( Before anyone tells me that http://api.espn.com/v1/now is no longer working I know, but I tried different ones including my site , the response from the API Explorer Sandbox works fine.

The problem I see is that call is empty which leads me to think something is not being passed through.

Screen Shot 2017-01-02 at 10.01.32 AM.png

 

Intel XDK version 3759

Here are my files:

apiconfi.json:

{
  "anyservice": {
    "name": "Any Service API",
    "description": "A great API",
    "dashboardUrl": "http://",
    "auth": "key",
    "requiredLibraries": [
      "http://example.api/example-api.js"
    ],
    "compatibleProjectTypes": [
      "com.intel.xdk.projecttype.jsapp",
      "com.intel.xdk.projecttype.webapp",
      "com.intel.xdk.projecttype.iotapp"
    ],
    "signature": "apiSecret"
  }
}
anyservice.json
{
  "endpoints": [
    {
      "name": "now",
      "dashboardUrl": "http://developer.example.api/resourceGroupA",
      "methods": [
        {
          "MethodName": "default",
          "Synopsis": "Grabs information from the A1 data set for a specific user",
          "parameters": [
            {
              "Name": "leagues",
              "Required": "Y",
              "Default": "nba",
              "Type": "string",
              "Description": "Description of the first parameter."
            },
            {
              "Name": "another",
              "Required": "N",
              "Default": "hhh",
              "Type": "string",
              "Description": "The userId parameter that is in the URI."
            }
          ]
        } 
      ]
    }
  ]
}

 

anyservice.js

(function (credentials, helpers) {
  var exports = {};

  /* Data Feed Function */

  exports.default = function(params) {
    var url = 'http://api.espn.com/v1/now';
	params['apikey'] = credentials.apiKey;  
    url = url + '?' + $.param(params);
    return $.ajax({url: url, type: 'GET'});
  };
  return exports;
})

I also noticed you can't get rid of the line 

   "requiredLibraries": [
      "http://example.api/example-api.js"
    ],

 

As it would cause an undefined errors when I try the service. 

As you can tell I'm quite new to all this, hence any help would highly appreciated.

Tags (2)
0 Kudos
6 Replies
PaulF_IntelCorp
Employee
91 Views

Have you also reviewed this doc page? > https://software.intel.com/en-us/xdk/docs/using-web-services < especially the section titled "Integrating Your Own Services"?

Ahmad_G_
Beginner
91 Views

Hi Paul,

Yes I have a few times, its pretty much the same instructions as the video. I have also looked around in forums and found we must include in the compatibleProjectTypes apiconfig.json file otherwise it doesn't show up in the list. 

Have I missed something?

PaulF_IntelCorp
Employee
91 Views

There is a bug that was recently uncovered, you might be succumbing to the same. I don't have the details, so I can't say for sure. This is the thread > https://software.intel.com/en-us/forums/intel-xdk/topic/703233 <

Ahmad_G_
Beginner
91 Views

Thanks Paul, this matches the same symptoms I'm experiencing. I will follow it ..

Is there a way to download an older version of XDK?

Appreciate the help

Ahmad_G_
Beginner
91 Views

I downloaded version 3522 to get it working for now... 

Tested with my existing project it didn't work as well.. so started from scratch and its working, will use it until 3759 is fixed.

This is the same as the issue in topic https://software.intel.com/en-us/forums/intel-xdk/topic/703233 

PaulF_IntelCorp
Employee
91 Views

You can find the previous download links to the previous version (3641) in this thread > https://software.intel.com/en-us/forums/intel-xdk/topic/705276 <

Reply