Jump to content
We have recently updated our Privacy Statement, available here ×

Help using Scribe Web API to install connectors and provision a cloud agent


Jamie Lowe

Recommended Posts

I'm new to Scribe and been using a mixture of Web API Reference application and the interactive API explorer to learn. The documentation makes sense but I just can't get things to work as I would expect! Hoping somebody can help...

 

I've written a PHP/cURL application to create a new Organisation and invite a user to the new organisation - this works fine.

 

Looking at: https://dev.scribesoft.com/en/main/how/provision_child_org.htm - I now need to provision a cloud agent (I am planning on using the Salesforce Connector) and also install the connectors (Just Salesforce for now, whilst my company work on deploying a new connector to the marketplace) - according to the documentation, neither endpoint return a response, which would be fine if it actually worked!!

 

My code:

Link to comment
Share on other sites

Are you intending to create a child organization You should have a parent org when you log in. The call for provisioning an agent on an existing org is POST/v1/orgs/{orgId}/agents/provision_cloud_agent

where you provide the orgId of the org (parent or child) you are intending add the agent to.

Adding connectors is done at the org level and all agents of that org will automatically install the enabled connectors for the org. The call for this is : POST/v1/orgs/{orgId}/connectors/{id}/install

Creating a child org under your current parent org requires a json model described under the call with the org specific settings which is passed in the body of the call. Creating the child org and adding agents and connectors should be done in two different calls to my knowledge.

Link to comment
Share on other sites

Hi Leon,

 

Thanks for your response - I understand the Scribe data model and API already (I think) so your answer seems to confirm that what I am doing already is correct.

 

I create a Child Organisation under my parent org called Workbooks Solutions which returns an ID of 34871 as shown

 

From here I call the Marketplace to find out which connectors are available for Salesforce using:

 

GET marketplace/connectorsfilterByName=Salesforce

 

This returns 2 connectors.

 

I then provision an agent on the Child Org using the ID from the Child Org creation response i.e.

 

POST/v1/orgs/34871/agents/provision_cloud_agent

 

After that I loop over the connectors that I found earlier in the same org using:

 

POST/v1/orgs/34871/connectors/{id}/install

 

Where {id} is replaced with the connector Id... However, nothing happens with this either - screenshot of my account after all of these calls:

 

Agent:

 

 

 

I hope this helps to confirm - Any ideas

Link to comment
Share on other sites

Have you tried testing these calls on the API page, filling in the org id's in question Also have you checked the response code from the call it should come back as either a 200 if it succeeds or a 400 or 401 if it fails I would put in a longer wait as actions like creating an org or provisioning a cloud agent could take significantly longer a loop checking for the addition of a child org or a addition of a new agent and give it up to a couple minutes to be shore then throw an exception. It may just be timing that the new org is not ready to add agents etc. If you are getting 200's back and you do not see anything in the scribe application after a long wait then I would contact Scribe Support directly. They are very helpful, and should be able to review logs to determine the cause of the issue.
Link to comment
Share on other sites

Yeah I tried that and weirdly, those calls work! Which is what makes me think it something wrong with my code - however, when I look at the URLs and the parameters I'm sending across in my calls, everything appears to be in order going by the documentation!

 

With all the calls, I log the results... The Child Organisation is created straight away and returns the ID/Name amongst a bunch of other data. It is visible in the UI straight away and the user is invited straight away so I know the Organisation is created correctly and also available immediately.

 

I'll have to do some more testing on this and check the error code for the Agent provisioning or wait a bit longer than 3 seconds before calling agains. The weird thing is, via the the API explorer page - the cloud agent is provisioned immediately and I can see it in the UI almost straight away!

 

Scribe wanted to charge me for a consultant on this unfortunately as they don't appear to help with API requests - I am in the process of trying to arrange.

 

Thanks for the suggestions so far.

Link to comment
Share on other sites

  • 2 weeks later...

So I noticed response for the call creating an org should be returning a camelcase "Id". This may be the issue.

{

"Id": 0,

"Name": "",

"Administrators": [

""

],

"ParentId": 0,

"TenantType": 0,

"Website": "",

"Street": "",

"City": "",

"State": "",

"PostalCode": "",

"Country": "",

"PrimaryContactFirstName": "",

"PrimaryContactLastName": "",

"PrimaryContactEmail": "",

"PrimaryContactPhoneNumber": "",

"PrimaryContactStreet": "",

"PrimaryContactCity": "",

"PrimaryContactState": "",

"PrimaryContactPostalCode": "",

"PrimaryContactCountry": "",

"IsSourceDataLocal": false,

"SecurityRules": [

{

"Name": "",

"ApiAccessEnabled": false,

"EventSolutionAccessEnabled": false,

"AllowedIpRangeStartAddress": "",

"AllowedIpRangeEndAddress": "",

"id": ""

}

],

"ApiToken": "",

"IsAgentLogDownloadAllowed": false,

"TenantRole": "",

"Status": "",

"SolutionStatusErrors": [

""

],

"DataCenterId": 0,

"DataCenterName": "",

"DataCenterLocation": "",

"IsTibcoOrg": false

}

Link to comment
Share on other sites

I actually managed to fix the problem here. It was related to my CURL call, rather than the response itself.

In the POST call, I wasnt sending CURLOPT_POSTFIELDS in my curlopts array when there was no body to send. This was causing the call to fail silently as in scribe wasnt doing anything with the data or giving me a response. I added CURLOPT_POSTFIELDS as a blank value and it now works!

Appreciate the assistance on this though!

Link to comment
Share on other sites

×
×
  • Create New...