0

I've an IBM Cloud Functions action called dealership. This action takes some information from a Cloudant database. If I run this action on IBM Cloud Functions web interface, I get the desired results, see picure below, then the action is OK:

IBM CF WEB Results

Then I make this action availble from web

enable http request

And then, if I call this action from web browser, postman, webapp, anything I got status 204 (no content). Why?

data_henrik
  • 16,724
  • 2
  • 28
  • 49

1 Answers1

1

My guess is that you called the base URL, not the URL with the JSON extension. Because web action can return different results, you need to add the Functions content extension to the base URL.

https://<apihost>/api/v1/web/<namespace_ID>/<packageName>/<actionName>.<ext>
data_henrik
  • 16,724
  • 2
  • 28
  • 49
  • Hi Henrik ! Nice to meet you. I put .json as you suggest. I can receive some little bit information but my body content shows body : [ ] – Fábio Valentim Jul 19 '23 at 06:02
  • { "body": [], "headers": { "content-type": "application/json" }, "statuCode": 200 } – Fábio Valentim Jul 19 '23 at 06:39
  • The correct sender should return....{ "body": [ { "_id": "e93d6c17e47613e5b5e426bfc27f73e3", "_rev": "1-6d3a316e140863cdb147048888d26051", "car_make": "Audi", "car_model": "A6", "car_year": 2010, "dealership": 15, "id": 1, "name": "Berkly Shepley", "purchase": true, "purchase_date": "07/11/2020", "review": "Total grid-enabled service-desk" } ], "headers": { "content-type": "application/json" }, "statuCode": 200 A – Fábio Valentim Jul 19 '23 at 06:40
  • This is API endpoint https://us-east.functions.appdomain.cloud/api/v1/web/c1b04453-0e1d-493b-a3a7-02f5dd95feba/dealership-package/review.json?dealerId=15 – Fábio Valentim Jul 19 '23 at 06:42
  • The status code 200 says that the request was successful. Now, the question is whether you provide all the required parameters. Do you have some default parameters configured when testing it directly in Functions? – data_henrik Jul 19 '23 at 06:56
  • on my node.js endpoint works great adding .json but in python this problem remain. – Fábio Valentim Jul 19 '23 at 07:00
  • In python only default paraments is the same on node, just authentication to Cloudant. The API I posted here need only one parameter named dealerId with value 15 – Fábio Valentim Jul 19 '23 at 07:04
  • and the Cloudant result is returned as result by the function? – data_henrik Jul 19 '23 at 07:05
  • Do You have any email or WhatsApp, I can send print. I'm using smartphone, I'm using IBM CF on mobile don't allow to copy code to paste here. My WhatsApp 5581996303366, fabiojvalentim@gmail.com – Fábio Valentim Jul 19 '23 at 07:10
  • Your last question, yes. – Fábio Valentim Jul 19 '23 at 07:12
  • I'm trying to solve this about a week :'( – Fábio Valentim Jul 19 '23 at 07:14
  • Open a new question with the Python code – data_henrik Jul 19 '23 at 07:29
  • Alright, now its 4:34AM I'm going to take a nap, later I'll open with screenshots , thank you very much henrik – Fábio Valentim Jul 19 '23 at 07:35