Query Environment hub records from salesforce API - google-chrome

I'm currently creating a chrome extension that will query EnvironmentHubMember records from our Salesforce org, however I'm currently getting this returned from the REST callout;
'"sObject type 'EnvironmentHubMember' is not supported."'
The endpoint I'm using is 'INSTANCENAME.COM/services/data/v20.0/query/?q=SELECT+Name+FROM+EnvironmentHubMember
I can't seem to find any specific settings to make this sObject available via an api call, has anybody been able to query these records from an external system before?
Thanks!

try using a later API version. The object itself was not available in version 20. The most recent version is 41.

Related

Large API call with no pagination

I need to retrieve data from an API source that has a massive amount of entries. (1800+) The problem is that the source has no pagination or way to group the entries. We are then saving the entries as post on the site and will run through a Cronjob daily.
Using curl_init() to retrieve the data from the API source. But the we keep getting a 503 error, timing out. When it works it retrieves the data as json saving important info with as metadata and the rest as json.
Is there a more reliable way to retrieve the data. On other sites I have worked on we have been able to programmatically run through an API per page in the backend.
You might try saving the JSON to a file first, then running the post creation on the JSON in the file vs. the direct cURL connection. I ran into similar issues in the past, even with an API that had pagination.

How to specify array fields in app script advanced services to be used in Google DataStudio?

Testing a change in a query in a App Script connector that connects to Google BigQuery, I have initially tried it in the native bigquery connector, using a custom query. One of the new fields I was fetching was an array, which worked graciously in DataStudio (the intention was building a word cloud, but also linking it to the complete string). However, passing the same query to the Google Apps Script connector, when trying to build a chart based on this array field, an error was returned.
Charts with direct bigquery connection
The same charts, with the same query, but with apps script connector:
The same inner query is sent back to bigquery. With the direct bigquery connector it properly unnests the words array when referencing it in a chart, but it fails when using the apps script connector.
My question is, is there any sort of configuration I need to do in the apps script code to successfully handle an array field, the same way the direct bigquery connection does it?
In Advanced Services, getSchema also support passing query configuration now. See implementation guide for details. Try passing the query configuration instead of building your own schema. That should work with nested and array fields.

Make a query to GA api with a service account credential

I discovers the use of GA report API. Yours helps and precisions are very important for me. I want to get datas from GA report api with a json format.
I have making a test : I have installed the GA client with composer, create an app, a service account credential, and create the HelloAnalytics.php script. It's ok I get datas with this script.
But, I want to retrieve datas with a json format. Then, I think that this method is not good. I think that I must use a query to get datas from GA api. Isn't it?
If yes, how can I associate the service account credential with a query to GA api? By default, a query to GA api has need 1 token.
Can you explain me how to proceed? Thanks very much for your help.
You mentioned composer which leades me to beleave that you are using php. If you are using the PHP client library then it returns all the data to you as objects.
Google APIs by default return their data as Json but the client libraries to make it easier for you return it as an object.
You might try the json_encode($b) method which should if memory serves take an object and turn it into json for you.

how to get number of pcf instances running in java code?

I have an app that uses spring rest and deployed on PCF. Now inside the code I have to get the number of PCF instances running currently. Can anyone help?
Before I answer this - why do you want to know? It's an anti-pattern for cloud native apps to know about their peers; they should each be working in total isolation.
You can discover this by looking up application details by GUID in the CloudController. You can get your current app's GUID in the VCAP_APPLICATION environment variable.
https://apidocs.cloudfoundry.org/245/apps/get_app_summary.html
In order to hit the CloudController your app will need to know the system domain of your Cloud Foundry (eg api.mycf.com) and credentials that allow it to make that request.

How do I update my web app's database when a change is made on QuickBooks Online?

I have a web app with a MySQL database we maintain in the cloud that we are trying to integrate with our QuickBooks Online account. We want to sync data between or web app's database and QuickBooks online, such as customer names and addresses. If they update their address in or web app, it's easy to then update it in QuickBooks online using the QuickBooks Online API. However, if they tell us their new address over the phone and we change it directly in QuickBooks online, we have no idea how to have that trigger something so that it automatically updates our MySQL web app. How do we go about doing this or learning about this process?
Intuit/QuickBooks has an API that's specifically geared towards this use-case. From the docs:
The change data capture (CDC) operation returns a list of entities that have changed since a specified time. This operation is for an app that periodically polls Data Services and then refreshes its local copy of entity data.
Docs are here:
https://developer.intuit.com/docs/0100_accounting/0300_developer_guides/change_data_capture
Basically you make an OAuth signed HTTP GET request like this:
https://quickbooks.api.intuit.com/v3/company/1234/cdc?entities=Class,Item,Invoice&changedSince=2012-07-20T22:25:51-07:00
And you get back a list of objects that have changed since the given date/time.
Your application can remember the last time you called this, and periodically call this API to get things that have changed since the last time you called it.
You get back something like this:
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-04-03T10:36:19.393Z">
<CDCResponse>
<QueryResponse>
<Customer>...
</Customer>
<Customer>...
</Customer>
</QueryResponse>
<QueryResponse>
<Invoice>...
</Invoice>
<Invoice>...
</Invoice>
</QueryResponse>
</CDCResponse>
</IntuitResponse>