Jump to content
Marcus Goluch

Custom Databases

Recommended Posts

1 hour ago, Graham Quince said:

Ah right.  I'll ask, but the only thing with Credits that I know of is the FrogPlay credits.  So it's either that or some never released functionality.

I don't believe there is an external version of the category API.  If you can't call the existing one after authenticating in, then I think you'll need to put it on the Ideas Portal. 

Confirmed - the credits api refers to FrogPlay

And

When we say "External APIs", it is referring to APIs that we as a company do not change.  these are APIs external users can use.  Internal APIs might be adapted by our developers and while ideally you wouldn't use these, there is nothing stopping an outside of the platform, authenticated call from using them.    Just be aware that Internal APIs are subject to change.

Link to comment
Share on other sites

thanks @Graham Quince So, I can use the endpoint for the category API.

What is the best way of getting the info on the internal API end points and parameters?

Otherwise I'll be browsing though obscured frogOS java script clientside code looking for them for days.

Frog's user front end is exceptionally complex :D

Link to comment
Share on other sites

@Graham Quince Can you please verify I am doing this correctly since all the internal API (2) calls just seem to hang and i never get a response.

 

I am trying to query users.getDataInCategory as you sugested.

MIS data is located under uuid 66851A4F2004C1C988B59F411F928605CB7D97BCEDF3177F.

 

So, I am sending a GET request to https://<frog-server-address>/api/2/

with the following parameters:

method: users.getDataInCategory
_device_class: computer
user_uuid: <Put student frog uuid here>
uuid: 66851A4F2004C1C988B59F411F928605CB7D97BCEDF3177F

This means that the request should look this this:

https://<frog-server-address>/api/2/?method=users.getDataInCategory&_device_class=computer&user_uuid=EXAMPLE&uuid=66851A4F2004C1C988B59F411F928605CB7D97BCEDF3177F

I also have the oAuth 1.0 headers that are working for the external API (1).

But yet I get no response and it just hangs, any sugestions?

Link to comment
Share on other sites

All the 1.0 api calls work fine.

I have tried 2 of the 2.0 api calls and they do not work and just hang.

 

I would try more but, I have only dug up how to use:

users.getSummary

users.getDataInCategory

 

If you have any for me to try I am happy to.

Link to comment
Share on other sites

Ok, hold onto your hat @Graham Quince because your now heading into one of my rabbit holes.

 

So, firstly I have a function that uses the node js request library to make an API call on the Frog 1 API.

This takes an API endpoints url and creates the API request with the oauth headers.

const fCallAPI = (sToken, sTokenSecret, sMethod, sURL, oParams = { }, fDone) => {

		let oConfig = pFrogApi.config.get();

		oPrototype.request(`${oConfig.oauth.frogsite}/${sURL}`,
			{
				method: sMethod,
				oauth:
				{
					consumer_key: oConfig.oauth.clientid,
					consumer_secret: oConfig.oauth.clientsecret,
					token: sToken,
					token_secret: sTokenSecret
				},
				headers:
				{
					"X-AuthType": "oauth_1_0_a"
				},
				qs: oParams,
				json: true
			},
			(err, req, body) => {
				if (!fDone) return;
				if (err || !body) fDone(`Frog API error '${sURL}'`);
				if (body.status == "error") return fDone(`Frog API error '${sURL}' ` + body.response.message);
				fDone(null, body.response);
			}
		);

	};

And this function works perfectly, no issues (example).

const fUserByID = (sToken, sTokenSecret, sID, fDone) => {
		fCallAPI(sToken, sTokenSecret, "GET", "api/fdp/2/user/get", {uuid: sID}, fDone);
	};

 

So, now I have a second function to call the Frog 2 API, by creating the request information and passing it to the Frog 1 API function .

 

const fCallAPI2 = (sToken, sTokenSecret, sMethod, sFunction, oParams = { }, fDone) => {

		fCallAPI(sToken, sTokenSecret, sMethod, "api/2/",
			Object.assign({
				method: sFunction,
				_v: "2010_0_20",
			}, oParams),
		fDone);

	};

 

How ever when I call this function I never get a response, instead it just hangs.

fCallAPI2(sToken, sTokenSecret, "GET", "users.getDataInCategory", {
	_device_class: "computer",
	user_uuid: sUserUUID,
	uuid: "66851A4F2004C1C988B59F411F928605CB7D97BCEDF3177F"
},
(oErr, oResults) => {
	console.log("ERROR ", oErr);
	console.log("RESULTS ", oResults);
});

 

Link to comment
Share on other sites

Hi Marcus,

I asked a developer to check the error logs and there's nothing apparent.  Can you try again please and note the exact time and how long before anything happens.  We can then check the logs again and try to narrow down the issue.

Graham

Link to comment
Share on other sites

@Graham Quince

The category uuid for the MIS data was not easy to locate and I will assume it is a different UUID per server.

The idea of the platform I am creating is for it to be used by other schools and thus I need a solution for finding the correct category with out user input.

I am not liking the idea of writing an installation manual that says fire up Google chromes networking console and reverse engineer an internal API call.

Is there a way for me to look up that uuid for mis data if not can an endpoint for it be added?

 

Link to comment
Share on other sites

13 minutes ago, Marcus Goluch said:

@Graham Quince

The category uuid for the MIS data was not easy to locate and I will assume it is a different UUID per server.

The idea of the platform I am creating is for it to be used by other schools and thus I need a solution for finding the correct category with out user input.

I am not liking the idea of writing an installation manual that says fire up Google chromes networking console and reverse engineer an internal API call.

Is there a way for me to look up that uuid for mis data if not can an endpoint for it be added?

 

Hi

UPN is available via a simple call:

var user = FrogOS ? FrogOS.getUser() : this.getUser(),
    upn = user.pupil_number;

And email and username are also included in getUser();  I take it you're after the MIS ID instead?

users.getOne is returns a lot of information about the user, including the category UUIDs when you first look at a user in the Users app.

users_getone.PNG

Link to comment
Share on other sites

Posted (edited)

Thank you

That sounds like exactly what I need, just out of curiosity do we have a function that returns the same data as users.getOne but for all users?

 

I am writing up a sync task and the less api calls the better, otherwise I am going to have to do 1 API and 1 MYSQL call per user. Whilst this is the nature of such applications, short cuts are always welcome.

 

 

 

Edited by Marcus Goluch
Link to comment
Share on other sites

2 hours ago, Marcus Goluch said:

Thank you

That sounds like exactly what I need, just out of curiosity do we have a function that returns the same data as users.getOne but for all users?

 

I am writing up a sync task and the less api calls the better, otherwise I am going to have to do 1 API and 1 MYSQL call per user. Whilst this is the nature of such applications, short cuts are always welcome.

 

 

 

Not sure what you mean about all users.  Looking at the API calls I can see (not directly at the codebase) it looks like you do need a user UUID for this.  The Categories returned with fields based on the user (probably a bit of forward planning so that different categories are return on different set ups).

Link to comment
Share on other sites

If you find the uuid of the student profile group you could use one of the group apis to return all students. You might need to call a second api to get the specific details about the student you want (can’t remember what attributes are  returned in the group api) but you can do this in batches rather than one at a time.

You will have to go deep into promises and asynchronous code for this - argh!

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Similar Content

    • By Sean_M
      Hello
      Wondering if anyone could help with an issue which popped up for some of our users (just students by the looks of it), seemly out of nowhere with no known changes to permissions, policy settings, etc.
      Student users are having the error, screenshot attached, "You do not have the required access to open menu.docs.network_drive.user_drive.default.".  When navigating to a page with the Network Files widget to their Home folder. Or in FrogDrive > Home Drive.
      I've checked the policy permissions for FrogDrive and Network Files apps/widgets, file paths in Users is correct, permissions of the folder on the file server. Nothing out of place as far as I can see.
      What setting am I missing to check? 
       
      Many thanks
      Sean

    • By Graham Quince
      Here's a new FrogCode widget:
      https://www.frogeducation.com/community/frogcode/frogcode-showcase/visitor-log
      We worked with George Bligh from Greenshaw on this widget.  When someone views a page with this widget on, it records their visit.  Anyone with Edit and Manage rights gets a button which displays a list of all visitors, their profile, their children (if a parent), how many times they have visited the site and the time and date of their last visit.

      (This widget uses the datastore - a little known about feature of Frog's API.)
       
      Updates
      This latest version 2.2 includes a "copy to clipboard" button, which allows you to copy the whole table and paste it into a spreadsheet program like Excel.
      The second new feature includes the ability to alter the Datastore's reference.  So if you wish to reset the log, instead of deleting the widget and adding it again, you can now change the reference and the information will remain stored.
       
    • By Graham Quince
      The brilliant @Simon Law has built a new widget which adds a site's menu to a page, to save us all from having to do this manually using text widgets.
      You can download this from the showcase page:
      https://www.frogeducation.com/community/frogcode/frogcode-showcase/navigation
    • By Graham Quince
      When I posted the snippet to allow you to restyle of My Notes, I hadn't thought that it wasn't as straight forward to change the title of Phrase of the Day. This bit of CSS is the easiest way I've found of changing all Phrases of the Day, although if you combine it with the the technique(?) mentioned in the restyling My Notes, you can restyle individual widgets in the same way.
      <style> .widget_phrase-wrap .header { height:50px; overflow:hidden; } .widget_phrase-wrap .header h2::before { content: 'My own title \a'; white-space: pre; } </style>  
    • By ann
      Hi
      Is there any way I can get a nested page to be centred on a page?
      I have created a number of pages with three equal columns - each one has an text widget containing an icon image linked to various places. Each of these 3 column pages are then nested onto one page.
      It looks fine on a PC as all three columns show across the page  but on a phone it justifies to the left.upsetting the design. 
       
      Thanks
      Ann

×
×
  • Create New...