Use the API with cURL

Modified on Tue, 23 Jan at 3:45 PM


In this article, you will learn how to request our API using cURL.

SUMMARY


Introduction to cURL

What is cURL ? 

    curl is a tool for transferring data from or to a server using URLs. 

    It supports these protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS.


cURL documentation is available here.

Example requests for the Portal

Take the following request, which retrieves the INFO bulletins created on 11 September 2023:

https://leportail.xmco.fr/api/advisory/?where={"advisory_type":{"$in":["INFO"]},"_created":{"$gte": "Mon, 11 Sep 2023 00:00:00 GMT","$lte": "Mon, 11 Sep 2023 23:59:59 GMT"}}


With cURL, the following arguments must be used :

  • with the API token
curl -v -H "Content-Type: application/json" -H 'Authorization: Bearer <token>' -X GET 'https://leportail.xmco.fr/api/advisory/' --data-urlencode 'where={"advisory_type":{"$in":["INFO"]},"_created":{"$gte":"Mon, 11 Sep 2023 00:00:00 GMT","$lte":"Mon, 11 Sep 2023 23:59:59 GMT"}} -G
  • with the session cookie
curl -v -H "Content-Type: application/json" -H "Cookie: XMSESSION=XXXXXXXX" -X GET 'https://leportail.xmco.fr/api/advisory/' --data-urlencode 'where={"advisory_type":{"$in":["INFO"]},"_created":{"$gte":"Mon, 11 Sep 2023 00:00:00 GMT","$lte":"Mon, 11 Sep 2023 23:59:59 GMT"}} -G

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article