Web Services: Export Content from client orgs

Simon Barby shared this question 3 years ago
Answered

Hi guys,


I am attempting to run the GETCONTENT command on a client org (not the default org) and I am being returned a null for the contentResources variable in the AdministrationServiceResponse object.


Does the GETCONTENT function work on client orgs or or could you direct me to an example running against a client org?


Thanks and Kind Regards,

Best Answer
photo

Hi Simon,

Thanks for sending in the question. You can indeed run GETCONTENT against client orgs. I have a hunch you are probably missing 'setOrgRef()' from your web service call. Here is an example of GETCONTENT returning content used by a client org:


  1. String host = "localhost";
  2. Integer port = 7272;
  3. String path = "/services/AdministrationService";
  4. AdministrationServiceResponse rs = null;
  5. AdministrationServiceRequest rsr = null;
  6. AdministrationServiceService ts = new AdministrationServiceServiceLocator(host, port, path, false);
  7. AdministrationServiceSoapBindingStub rssbs = (AdministrationServiceSoapBindingStub) ts.getAdministrationService();
  8. AdministrationPerson ap = new AdministrationPerson();
  9. AdministrationClientOrg aco = new AdministrationClientOrg();
  10. AdministrationReport ar = new AdministrationReport();
  11. rsr = new AdministrationServiceRequest();
  12. rsr.setLoginId("admin@yellowfin.com.au");
  13. rsr.setPassword("test");
  14. rsr.setOrgId(new Integer(1));
  15. //setOrgRef = to your client org's Client Reference ID
  16. rsr.setOrgRef("123");
  17. rsr.setFunction("GETCONTENT");
  18. //rsr.setParameters(new String[] { "DASHBOARDS" } );
  19. rsr.setClient(aco);
  20. ar.setDashboardEnabled(true);
  21. rsr.setReport(ar);
  22. rs = rssbs.remoteAdministrationCall(rsr);
  23. for (ContentResource p : rs.getContentResources()) {
  24. out.write("Content Type:" + p.getResourceType() + " Content Name: " + p.getResourceName() + " UUID: " + p.getResourceUUID() + " ID: " + p.getResourceId() + "<BR>");
  25. }

You would just need to change rsr.setOrgRef("123"); to match the org reference ID for your client org. Could you give this a shot and let us know if this works for you? Let me know if you run into troubles or if you have any follow-up questions etc.

Kind Regards,

Dustin

Comments (2)

photo
1

Hi Simon,

Thanks for sending in the question. You can indeed run GETCONTENT against client orgs. I have a hunch you are probably missing 'setOrgRef()' from your web service call. Here is an example of GETCONTENT returning content used by a client org:


  1. String host = "localhost";
  2. Integer port = 7272;
  3. String path = "/services/AdministrationService";
  4. AdministrationServiceResponse rs = null;
  5. AdministrationServiceRequest rsr = null;
  6. AdministrationServiceService ts = new AdministrationServiceServiceLocator(host, port, path, false);
  7. AdministrationServiceSoapBindingStub rssbs = (AdministrationServiceSoapBindingStub) ts.getAdministrationService();
  8. AdministrationPerson ap = new AdministrationPerson();
  9. AdministrationClientOrg aco = new AdministrationClientOrg();
  10. AdministrationReport ar = new AdministrationReport();
  11. rsr = new AdministrationServiceRequest();
  12. rsr.setLoginId("admin@yellowfin.com.au");
  13. rsr.setPassword("test");
  14. rsr.setOrgId(new Integer(1));
  15. //setOrgRef = to your client org's Client Reference ID
  16. rsr.setOrgRef("123");
  17. rsr.setFunction("GETCONTENT");
  18. //rsr.setParameters(new String[] { "DASHBOARDS" } );
  19. rsr.setClient(aco);
  20. ar.setDashboardEnabled(true);
  21. rsr.setReport(ar);
  22. rs = rssbs.remoteAdministrationCall(rsr);
  23. for (ContentResource p : rs.getContentResources()) {
  24. out.write("Content Type:" + p.getResourceType() + " Content Name: " + p.getResourceName() + " UUID: " + p.getResourceUUID() + " ID: " + p.getResourceId() + "<BR>");
  25. }

You would just need to change rsr.setOrgRef("123"); to match the org reference ID for your client org. Could you give this a shot and let us know if this works for you? Let me know if you run into troubles or if you have any follow-up questions etc.

Kind Regards,

Dustin

photo
1

Hi Dustin,

My code works now. Using the setOrgRef works a treat :)

Before I was using the setOrgID method assuming that would work.

Thanks a bunch! Enjoy the rest of your day Dustin!

photo