Making your first request

Using PHP

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://demo.cloudonex.com/?api_key=4fy5ays2yuplj8c1g0bja033uueu8q3e4rsm3g4y&ng=api/v2/customers');
$content = curl_exec($ch);

var_dump($content);

Using Javascript / ReactJS

You can use fetch, axios etc to use with ReactJS.

You can also use this with React Native.

Example Using fetch -

import React from "react";
import ReactDOM from "react-dom";
import { Spinner, Table } from "reactstrap";

import "bootstrap/dist/css/bootstrap.min.css";
import "./styles.css";

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      data: false
    };
  }

  componentDidMount() {
    fetch(
      "https://demo.cloudonex.com/?api_key=4fy5ays2yuplj8c1g0bja033uueu8q3e4rsm3g4y&ng=api/v2/customers"
    )
      .then(response => response.json())
      .then(response => {
        this.setState({
          loading: false,
          data: response
        });
      });
  }

  render() {
    if (this.state.loading) {
      return <Spinner color="primary" />;
    }
    return (
      <Table bordered>
        <thead>
          <tr>
            <th>#</th>
            <th>Name</th>
            <th>Email</th>
          </tr>
        </thead>
        <tbody>
          {this.state.data.map((listValue, index) => {
            return (
              <tr key={index}>
                <td>{listValue.id}</td>
                <td>{listValue.account}</td>
                <td>{listValue.email}</td>
              </tr>
            );
          })}
        </tbody>
      </Table>
    );
  }
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

Result

By continuing to use this site you consent to the use of cookies in accordance with our Cookie policy. close notification