Using bookmark parameter with /users/ - desire2learn

I have been reviewing the documentation located at http://docs.valence.desire2learn.com/res/user.html
I am trying to paginate the number of response i get from /users/.
When i send a get with "/users/" I recieve the expected Json block with all of the users in D2L.
When i try "/users?bookmark=3004" I recieve a 404 error or a path not found error (I have tried many variations on this line of code)
Any asistance would be appreciated.

Note that the route ends with a slash: "/d2l/api/lp/{ver}/users/". This means that your call needs to look something like this:
https://your.lms.domain/d2l/api/lp/1.0/users/?x_b={userId}&x_a={appId}&x_d={userSig}&x_c={appSig}&x_t={timestamp}&bookmark=3004

Related

Cannot bind query parameter; Unknown name basicRequest when retrieving basic insights for a location

I'm trying to retrieve insights for a location using the Google Business Profile API. I've tried a few approaches, but I always get an error about "Cannot bind query parameter".
According to the docs, I should be posting to this URL: https://mybusiness.googleapis.com/v4/accounts/xxx/locations:reportInsights
and in the body, pass in an array of locationNames, but when I do that, I get the error about "Cannot bind query parameter 'locationNames'".
So I just tried doing a GET on this URL and pass in the names on the name querystring and that worked just fine to get the high-level data.
https://mybusiness.googleapis.com/v4/accounts/xxx/locations:reportInsights?name=accounts/xxx/locations/xxx
So I know I have the right account ID, location ID, etc. But I need to be able to add in the basicRequest parameter so I can indicate which metric that I want to retrieve.
So I've POST to both of those URLS above with a body that looks like this:
{"basicRequest":{"metricRequests":[{"metric":"ALL"}],"timeRange":{"startTime":"2020-10-12T01:01:23.045123456Z","endTime":"2022-01-10T23:59:59.045123456Z"}}}
But again, I get the same errors about "Cannot bind query parameter" to field "basicRequest" (Same as when I tried to pass in the "locationNames" param in the JSON.
So clearly, I'm doing something wrong with how I am sending in the parameters in the body because it doesn't seem to think any of those parameter names are valid. My end goal is to be able to retrieve queries_direct, actions_total, etc.
I'm using Ruby, and there isn't a client library for it, so I'm just crafting the URLs and the JSON body and doing a GET or POST to it.
Greatly appreciate any pointers!

Using Rails globbing for URL parameters: some URL types get cut off

I'm having an odd problem with Ruby on Rails globbing. My route looks like this:
get 'people/info_from_url/*url', to: 'people#info_from_url'
So from the frontend, I have get requests to URLs like:
my-api.com/people/info_from_url/youtube.com/XXX
my-api.com/people/info_from_url/twitter.com/XXX
my-api.com/people/info_from_url/tinyurl.com/XXX
...
These all work as expected - I get a parameter in the people#info_from_url controller action called url that contains the full URL that was sent.
However, for one particular kind of URL (XXX.carrd.co), the last part gets cut off. In the frontend, I send a get request to my-api.com/people/info_from_url/XXX.carrd.co. From the backend logs:
INFO -- : Started GET "/people/info_from_url/XXX.carrd.co/"
INFO -- : Processing by PeopleController#info_from_url as
INFO -- : Parameters: {"url"=>"XXX.carrd"}
Somewhere, the .co gets dropped. I'm not sure why this could be happening or how to debug it, since the change happens before I'm able to access the params hash. I could deal with this manually by just checking if it's a carrd link, but I'd like to know why it's happening and if any other kind of link might experience this issue. Thanks for any help!
Routes have an implicit optional (.:format) segment at the end. You can use this option to prevent that:
get 'people/info_from_url/*url', to: 'people#info_from_url', format: false
EDIT: you can check the last part here in the docs explaining that too https://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments

How to send drafts content to makeslides using callback URL

I am using drafts 5 and would like to convert the markdown into a powerpoint using a callback URL action. It appears like it should be quite straightforwards but Im not getting any success using the following:
makeslides://x-callback-url?input=[[draft]]&type=md&name=mydoc
I just keep getting an error message saying invalid URL generated. Any ideas on how to get this to work?
I manage to get it working when I do two steps, first copy to clipboard and second use the callback URL to makeslides
makeslides://x-callback-url?input=[[clipboard]]&type=md&name=[[title]]

Null exception after calling Post Request

I am building a web api on asp.net. I make requests through client and server. GET and DELETE methods are working properly. When i make POST or PUT i get an error "Response status code does not indicate success: 500 (Internal Server Error)."
Client:
Server:
I used this tutorial.
Why i get a null object (Employee)?
If AddEmployee is an endpoint, then you may need to put the [FromBody] attribute on the parameter.
If it's not an endpoint, then I don't see where AddEmployee is being called. But it looks like the employee parameter is the one that is null. Look up the stack trace, and I bet you'll find someplace where employee is not being set.
I dont know how but when i built a new project the error dissapeared... I used the exact same files and classes.

Post comment on note via Javascript SDK

I am attempting to use the JavaScript SDK to post a note from my site and then allow a comment to be posted to that note immediately following. I am successful in the first part. Here is a relevant snippet:
alert('posting to path (' + path + ') with params (' + JSON.stringify(params) + ')');
FB.api(path, "post", params, function(response) {
if (response.error) {
alert(response.error.type + ": " + response.error.message);
} else {... do stuff ...}
Notice that I am dumping the variables I am passing for inspection. The results go like this:
When posting the note:
posting to path (/100003217376622/notes) with params ({"access_token":"AAAChRmSu9s8BACFDhWCFnIS8R3OTZCSxZAyL4hLbAQxGUrn0t4ksZC5CS62qlLtAIconOKCreAUpaorzOZCHkxp2DlTfcc2c8vOY5MOLPdHMqdfWMu2V","subject":"Note #1","message":"My note"})
This works fine and the number preceding "/notes" is my profile id.
However, I subsequently try to post a comment to that note and end up with the following.
When posting a comment to that note:
posting to path (/124528970997681/comments) with params ({"access_token":"AAAChRmSu9s8BACFDhWCFnIS8R3OTZCSxZAyL4hLbAQxGUrn0t4ksZC5CS62qlLtAIconOKCreAUpaorzOZCHkxp2DlTfcc2c8vOY5MOLPdHMqdfWMu2V","message":"Comment on Note # 1"})
This results in an error, shown below:
OAuthException: (#200) Cannot access object_id: 124528970997681
The number preceding "/comments" is, in fact, the id of the note, as when I hover over the note link on my wall, I see this URL: http://www.facebook.com/notes/danja-garno/note-1/124528970997681, which does lead me to the note.
Any idea why I would be getting this error?
============================= UPDATE =================================
This morning I posted a link instead of a note and then successfully posted a comment via the same form and code.
Now, I did notice two things that may provide a clue. First, the permalink for the link looks like this:
http://www.facebook.com/permalink.php?story_fbid=285359141511345&id=100003217376622
While the permalink for the note looks like this:
http://www.facebook.com/notes/danja-garno/note-this-note/127723150678263
ALSO, when I directly access these objects via the Graph API URL, I get two different responses.
I got a valid response for the link using this URL https://graph.facebook.com/141246962656776?access_token=AAAChRmSu9s8BAKedPE9DyZB5W0lQYgn71WkFFtR0wIBMHp3Qgr09vmZA7YhvzJbgoigQRHsaqXqOhpmrbzdhWd6QYV8jHvsKjSVMpLZBTD8GI9Lax7p
BUT, when I tried to access the note in the same way using this URL https://graph.facebook.com/124528970997681?access_token=AAAChRmSu9s8BAKedPE9DyZB5W0lQYgn71WkFFtR0wIBMHp3Qgr09vmZA7YhvzJbgoigQRHsaqXqOhpmrbzdhWd6QYV8jHvsKjSVMpLZBTD8GI9Lax7p
All it returned was "false". What's up with that?
I was finally able to get some time to try this out.
I can post a note, then post a comment to that note via the Graph API. I still think it's a timing issue where the graph is sluggish to cross save the note in all the places it needs to (and the graph's database may be the last datastore to be replicated). So I would suggest placing the comment into a hold queue for processing at a later time (maybe give it 1 minute).

Resources