Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEclipse
languagephp
linenumberstrue
// create a new cURL resource
$ch = curl_init();

// set options, url, etc.
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($ch, CURLOPT_URL, "https://api.rescuegroups.org/http/v2.json");

curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_POST, 1);

//curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

if (curl_errno($ch)) {

  $results = curl_error($ch)

} else {

  // close cURL resource, and free up system resources
  curl_close($ch);

  $results = $result;

}

...

Code Block
languagephp
linenumberstrue
Array
(
    [status] => ok
    [messages] => Array
        (
            [generalMessages] => Array
                (
                )

            [recordMessages] => Array
                (
                )

        )

    [foundRows] => 3
    [data] => Array
        (
            [define] => Array
                (
                    [modules] => Public
                    [permissions] => Public
                )

            [publicView] => Array
                (
                    [modules] => Public
                    [permissions] => Public
                    [fields] => Array
                        (
                            [animalID] => Array
                                (
                                    [name] => animalID
                                    [friendlyname] => ID
                                    [type] => key
                                    [lengthMax] =>
                                    [lengthMin] =>
                                    [default] =>
                                    [properties] => Array
                                        (
                                            [0] => required
                                        )

                                    [modules] => Public
                                )

                        )

                )

            [publicSearch] => Array
                (
                    [modules] => Public
                    [permissions] => Public
                    [fields] => Array
                        (
                            [animalID] => Array
                                (
                                    [name] => animalID
                                    [friendlyname] => ID
                                    [type] => key
                                    [lengthMax] =>
                                    [lengthMin] =>
                                    [default] =>
                                    [properties] => Array
                                        (
                                        )

                                    [modules] => Public
                                )

                            [animalOrgID] => Array
                                (
                                    [name] => animalOrgID
                                    [friendlyname] => Org ID
                                    [type] => key
                                    [lengthMax] =>
                                    [lengthMin] =>
                                    [default] =>
                                    [properties] => Array
                                        (
                                        )

                                    [modules] => Public
                                )

                            [animalActivityLevel] => Array
                                (
                                    [name] => animalActivityLevel
                                    [friendlyname] => Activity level
                                    [type] => string
                                    [lengthMax] =>
                                    [lengthMin] =>
                                    [default] =>
                                    [values] => Array
                                        (
                                            [0] =>
                                            [1] => Highly Active
                                            [2] => Moderately Active
                                            [3] => Not Active
                                            [4] => Slightly Active
                                        )

                                    [properties] => Array
                                        (
                                        )

                                    [modules] => Public
                                )

                            More fields will follow here...

                        )

                )

        )

)
Info

See the Actions page for additional information on the results of the define API call.

...

Code Block
themeEclipse
languagephp
linenumberstrue
// create a new cURL resource
$ch = curl_init();

// set options, url, etc.
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($ch, CURLOPT_URL, "https://api.rescuegroups.org/http/v2.json");

curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_POST, 1);

//curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

if (curl_errno($ch)) {

  $results = curl_error($ch);

} else {

  // close cURL resource, and free up system resources
  curl_close($ch);

  $results = $result;

}

...