API Endpoints

GET

You can use the following urls to retrieve your AR models in Json format. Please update your website domain and AR Display licence key in the urls.

This will return all your current AR Models
https://YOUR_WORDPRESS_WEBSITE_DOMAIN.com/wp-json/ar-display/models/?key=AR_DISPLAY_LICENCE_KEY

This will return the AR Model with post id 1234
https://YOUR_WORDPRESS_WEBSITE_DOMAIN.com/wp-json/ar-display/models/?key=AR_DISPLAY_LICENCE_KEY&id=1234

This will return an empty template for 1 AR Model
https://YOUR_WORDPRESS_WEBSITE_DOMAIN.com/wp-json/ar-display/models/?key=AR_DISPLAY_LICENCE_KEY&template=1

Python
import requests
r = requests.get("https://YOUR_WORDPRESS_WEBSITE_DOMAIN.com/wp-json/ar-display/models/?key=AR_DISPLAY_LICENCE_KEY&id=1234")
print(r.text)

POST

PHP
The script below can be used to POST a json array of model data to your site and have them added and/or updated dynamically. You will also find a copy of this script and others in the /api-examples/ folder within the plugins.

$key = 'AR_DISPLAY_LICENCE_KEY';
$wp_url = 'https://YOUR_WORDPRESS__WEBSITE_DOMAIN.com';
$json_data = '[{"id":"","title":"Title goes here","author":"1","date":"","status":"publish","usdz_file":"","glb_file":"","skybox_file":"","ar_environment":"","ar_placement":"","ar_x":"","ar_y":"","ar_z":"","ar_field_of_view":"","ar_zoom_in":"","ar_zoom_out":"","ar_exposure":"","ar_shadow_intensity":"","ar_shadow_softness":"","ar_rotate":"","ar_variants":"","ar_environment_image":"","ar_resizing":"","ar_view_hide":"","ar_qr_hide":"","ar_hide_dimensions":"","ar_animation":"","ar_autoplay":"","ar_cta":"","ar_cta_url":""}]';$post = ['key' => $key,'json'=> $json_data];
$ar_api_url = $wp_url.'/wp-json/ar-display/update/';
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ar_api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_REFERER, 'https://dev.augmentedrealityplugins.com/');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
$response = curl_exec($ch);
echo $response;

Python

import requests
url = "https://YOUR_WORDPRESS_WEBSITE_DOMAIN.com/wp-json/ar-display/update/"
r = requests.post(url, data = {"key": "AR_DISPLAY_LICENCE_KEY", "json": '[{"title": "Yes!", "status": "publish"}]'})