0

I am an amateur programmer and cannot figure this out based on the documentation and examples provided.

Based on their sample capsule on https://bixbydevelopers.com/dev/docs/sample-capsules/samples/http, they directly called

var response = http.getUrl(config.get('remote.url') + '/shoes', options);

They do have documentation on what http.getUrl parameters are but no examples on how it should be formatted syntax-wise.

I also don't know what would be the point of creating an endpoints.bxb for API calls file if they don't use it and just call it manually in the .js file.

Any help is greatly appreciated!

gmatcat
  • 155
  • 7

1 Answers1

1

The base method signature for http.getUrl is http.getUrl(url, options) where the url variable is a String and the options variable is a JSON object containing any or all of the following keys:

  • format: Output format.
  • query: Object containing unencoded keys and values for URL query string.
  • cacheTime: Cache time in milliseconds.
  • basicAuth: Basic Authentication; value must be an object with username and password.

You can learn more by exploring the documentation's http section here.

Regarding the http sample you referenced: It shows multiple ways to reach the same outcome. The endpoints.bxb file has the two following action-endpoints:

  1. A local endpoint where the GET is handled by the Javascript file:
    action-endpoint (FindShoe) {
      accepted-inputs ()
      local-endpoint (FindShoe.js)
    }
  1. A remote endpoint where the GET is defined within the endopoints.bxb file itself and doesn't require a Javascript file.
    action-endpoint (FindShoeRemoteEndpoint) {
      accepted-inputs ()
      remote-endpoint ("{remote.url}/shoes") {
        method (GET)
      }
    }
Ameya
  • 880
  • 6
  • 13