• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. jono

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    jono

    @jono

    0
    Reputation
    355
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    jono Unfollow Follow

    Latest posts made by jono

    • RE: Authenticating programmatically when using curl

      Thanks, Phil!

      The first option (2 headers) didn't work for me, but the second worked like a charm.

      The single header format that worked:

      Cookie: XSRF-TOKEN=[value];MANGO[port]=[value]

      The two headers format that didn't:

      X-XSRF-TOKEN: [value]
      MANGO[port]: [value]

      If my syntax in the latter option is wrong, let me know ... but the single cookie option works quite nicely.

      Thanks!

      posted in Dashboard Designer & Custom AngularJS Pages
      J
      jono
    • RE: Authenticating programmatically when using curl

      Hi, Phil,

      Many thanks! I'm getting the token, but I'm now getting a 403 return from /rest/v1/realtime/by-xid/[xid] call. I'm setting headers as follows (this is in PHP):

                 // Initialize curl options
      	$this->_curl_options = array(
      		CURLOPT_RETURNTRANSFER => TRUE,
      		CURLOPT_HEADER => TRUE,
      		CURLOPT_VERBOSE => TRUE,
      		CURLOPT_TIMEOUT => $this->_curl_timeout,
      	);
      
      	$headers = array(
      		'Accept: application/json',
      		'Accept-Encoding: gzip',
      		'Accept-Language: en-US,en;q=0.5',
      		'Connection: keep-alive',
      		'Cache-Control: no-cache',
      		"X-XSRF-TOKEN: {$this->_token}",
      	);		
      	$this->_curl_options[CURLOPT_HTTPHEADER] = $headers;
      	$this->_curl_options[CURLOPT_USERAGENT] = "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0";
      	$this->_call_api();
      

      Then, the _call->api() method makes the call:

      	$this->_curl_options[CURLOPT_URL] = $this->call_string;
      	$curl = curl_init();
      	curl_setopt_array($curl, $this->_curl_options);
      	
      	// Make the call
      	$response = curl_exec($curl);
      	curl_close($curl);
      

      Is this the right way to send the authentication token on the second call?

      Thanks!

      posted in Dashboard Designer & Custom AngularJS Pages
      J
      jono
    • Authenticating programmatically when using curl

      I'm trying to connect to the API programmatically using curl calls from our server. I'm sending a call to /rest/v1/login/[username] to log in, followed by a call to /rest/v1/realtime/by-xid/[xid] to get the data value.

      The login call works; it returns a response code of 200 and good data about the account. The second call, however, fails with 401 response (unauthorized).

      I also tried setting the USERPWD curl option on the second call, which lets you send user name and password as part of the call, but got the same result (401, unauthorized).

      How do you log in when making API calls using curl?

      Many thanks!

      posted in Dashboard Designer & Custom AngularJS Pages
      J
      jono