How to write JSON in body of HTTP request for {urlload} function

Hi,
I am trying to create a meeting at Zoom by API using {urlload} function (code is below) but I get 403 error (URL Contents:Invalid CORS request). I think the problem would be that I fail in sending JSON in the body of HTTP POST request. (c.f. Zoom API doc)
I would like to know how to send JSON in the body of HTTP POST request or if there is an alternative way.

Code

{urlload: https://api.zoom.us/v2/users/xxxx/meetings; 
headers=["Authorization"="Bearer XXXX, "Content-Type"="application/json"]; 
method=POST; 
body={=body};
start=()->["loading"=yes];
done=(contents, status)->["loading"=no, "contents"=contents, "status"=status]
}

{if: loading}
Loading URL...
{else}
Request Status:
{=status}
URL Contents:
{=contents}
{endif}


{body=
{
 "topic": "test",
 "type": "2",
 "start_time": "2021-07-05T10:00:00Z",
 "duration": "10",
 "schedule_for": "",
 "password": "",
 "agenda": ""
}
}

I tried

  • I succeeded in creating a meeting by API in another app (Postman:https://web.postman.co/). So, my JSON works in body of HTTP POST request at Postman.
  • I succeeded in sending GET request with Text Blaze. So, the header part works well at Text Blaze.
  • I replaced {=body} with {clipboard} (body={clipboard}) and copied JSON code before snippet, but did not work.

Ok, I'm gonna have to hide behind @scott for this one :sweat_smile:

I think something like this should work. Does it not?

{urlload: https://api.zoom.us/v2/users/xxxx/meetings;
headers=["Authorization"="Bearer XXXX", "Content-Type"="application/json"];
method=POST;
body={
"topic": "test",
"type": "2",
"start_time": "2021-07-05T10:00:00Z",
"duration": "10",
"schedule_for": "",
"password": "",
"agenda": ""
};
start=()->["loading"=yes];
done=(contents, status)->["loading"=no, "contents"=contents, "status"=status]
}

Hi Scott,

I tired but did not work....

What error do you get?

Hi Scott,
I receive this error

Request Status:
403
URL Contents:
Invalid CORS request

I sent the same JSON via Postman and it works.

You could trying adding "Origin"="null" or "Origin"="" to the headers of the urlload command. There is a small chance it may address it.

Looking at the zoom forums seems like a number of other people have run into this issue.

Hi Scott,

Thank you for directing me to look to Zoom Forum!
I tried to add "Origin"="null", "Origin"="" and also "Origin"="https://developer.zoom.us" following Zoom Forum in the header but did not work.

Based on this post at Zoom Forum in 2018, they said API call should be made from a server.

When calling the API, you’ll want to make sure that you are making the call from your server instead of the client. When making API calls from a client, you’ll run into CORS errors.

I think Text Blaze call API from a client? If so I assume an interceptor? (I do not know exactly) is needed to call API from Text Blaze (Postman solved invalid CORS request by providing interceptor extension to chrome) to Zoom?

I read these Zoom Forum posts, too

thank you for your reply though :laughing:

Hi @scott,
According to Zoom, their API shall be called from backend(screen shot is attached: Zoom API POST sending Invalid CORS request - #9 by shinta - API and Webhooks - Zoom Developer Forum).

I think Text Blaze calls API from frontend (Google Chrome browser), doesn't it? If so are there any ways to call API from backend?

Hi,

We don't provide a backend for {urlload} requests, they are instead made from the extension.

If you really wanted the request to come from a server, you could create your own backend and then have Text Blaze make requests to that.

Hi Scott,
Noted! Thank you for your comment. I will think about creating intermediate web app.