Scenario inputs are ignored when executing scenario via REST API

Hi all

I am developping an R application where I want to execute a Make scenario using the REST API POST method. So, I started to read the Make API docu and followed the instructions for setting up connection and authentication. The API works and I can, for example, send GET requests for listing scenario IDs.

However, executing a scenario with a POST request as described in the docu does not work propoerly. The scenario is executed - but the inputs are ignored.

For testing, I’ve set up a dummy scenario with two inputs:

And I mapped these inputs to the first module of the scenario:

Then I called the API from within R and verbose gives me the following info:

→ POST /api/v2/scenarios/xxxx/run HTTP/1.1
→ Host: eu1.make.com
→ User-Agent: libcurl/7.64.1 r-curl/4.3.3 httr/1.4.4
→ Accept-Encoding: deflate, gzip
→ Accept: application/json, text/xml, application/xml, /
→ Content-Length: 58

{“data”:{“name”:“klaus”,“asdf”:“fdsa”},“responsive”:false}

← HTTP/1.1 200 OK
← Date: Tue, 04 Apr 2023 19:16:17 GMT
← Content-Type: application/json; charset=utf-8
← Transfer-Encoding: chunked
← Connection: keep-alive
← X-RateLimit-Limit: 120
← X-RateLimit-Remaining: 119
← X-RateLimit-Reset: 1680635838
← authType: token
← api-version: 4.4.0-hotfix.1
← x-powered-by: Make Trigger/production
← Content-Encoding: gzip
← CF-Cache-Status: DYNAMIC
← Server: cloudflare
← CF-RAY: 7b2be2882f2e01fc-ZRH

I also tested independently of R with curl from the command line:

curl -X POST https://eu1.make.com/api/v2/scenarios/xxxx/run \
-H ‘Authorization: Token xxxx’ \
-d ‘{“data”:{“name”:“klaus”,“asdf”:“fdsa”},“responsive”:false}’

Again, the scenario was executed ignoring the inputs.

The last test I did was using the Make ‘Make an API call’ module:

And now – it worked!

The input generated by the ‘Make an API call’ module looks like this

I do not understand why this works and the calls from outside Make.com do not work. I cannot spot any difference in what is sent to my dummy scenario with inputs.

What am I missing?

Thank you very much for your help.

Thomas

I wish I have a better plan in Make to go through it in detail. But, I will try to review it based on what you shared here. I reviewed the verbose output and the cURL request as well and seems like the header for Content-Type is missing, For instance, if I run the cURL request that you are sending, I get this as a response when running it in verbose mode,

Note: Unnecessary use of -X or --request, POST is already inferred.

* Trying 172.65.253.237:443...
* TCP_NODELAY set
* Connected to eu1.make.com (172.65.253.237) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=eu1.make.com
*  start date: Oct  4 00:00:00 2022 GMT
*  expire date: Oct  4 23:59:59 2023 GMT
*  subjectAltName: host "eu1.make.com" matched cert's "eu1.make.com"
*  issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x556f9f2e0320)
> POST /api/v2/scenarios/xxxx/run HTTP/2
> Host: eu1.make.com
> user-agent: curl/7.68.0
> accept: */*
> content-length: 39
> content-type: application/x-www-form-urlencoded
> 
* We are completely uploaded and fine
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 401 
< date: Tue, 04 Apr 2023 20:59:10 GMT
< content-type: application/json; charset=utf-8
< content-length: 77
< x-ratelimit-limit: 10000
< x-ratelimit-remaining: 9999
< x-ratelimit-reset: 1680642011
< set-cookie: userId=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT
< set-cookie: sid=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT
< authtype: session
< api-version: 4.4.0-hotfix.1
< cf-cache-status: DYNAMIC
< server: cloudflare
< cf-ray: 7b2c793d0cca988a-KTM
< 
* Connection #0 to host eu1.make.com left intact
{"detail":"Access denied.","message":"User is not logged in.","code":"IM015"}

And, As you can see the Content-Type being sent through the cURL request is content-type: application/x-www-form-urlencoded instead of what is required. And, Same goes for the R code as well, correct me if I am mistaken but through R it is completely missing, So you need to specify Content-Type for it to reflect in Make.

Can you try the cURL request with this added to the Header and see how it goes,

-H "Content-Type: application/json"

1 Like

I thought that the higlighted line in my original post defined the content type as ‘application/json; charset=utf-8’.


Apparently, I misinterpreted this line. Specifying explicitly the content type in the request solves the issue.
Thank you very much for your help.

1 Like