D2L Valence - post feedback for a dropbox with no submission - php

I am currently implementing an app using the D2L Valence API. The goal is to upload 1 file per student (different for each student though) in some course. The file is now uploaded as a feedback for a combination of course-dropbox-student. Everything works perfectly as long as there is a submission from that student. If there isn't any - the call fails. I know this is possible to do via the UI (i.e. if I try to post a feedback through the UI for a user with no submission, it still works), but my question is would it be possible to do the same via API call. I tried simply attaching the file using this call (the file is uploaded before doing that) or posting a feedback and then attaching the file to it. Nothing works unless there is a submission. Thanks for any help.

I believe you're correct that the API doesn't currently support this behaviour (submitting feedback against a dropbox with no submission). If this behaviour does exist in the WebUI, then this would run contrary to D2L's stated goal that the API should be at feature/behaviour parity with the Web UI. I would therefore encourage you to report this as a defect via your organization's ASC or partner or account manager.

Related

php codeigniter rest api how to deal with images with put method best practice?

I am developing a api using codeigniter for user signup and user update profile.
I have image field in form. To create user i have used post method which works fine.
But issue i am getting when i am updating user. I know that with put request we have to send urlencoded or json data. But what should i do to update image?
Should i make 2 request? One with normal url encoded data (PUT request) and one with post request (Update image).
In rest api development which is the significant way to deal with these type of request?
can anyone help me?
You can try Advance Rest API plug-ins or browser extension, or you can try postman software for testing api with multipart-formdata (images)
enter image description here

Silent authentication via PHP when making API-call

First time posting, long time reading.
I want to perform a silent authentication against Azure AD but I can't seem to get it to work.
Please find image below which outlines steps and overall solution approach.
This is the current approach I have set up and it is working quite well:
User logs in and is authenticated against a SaaS solution via Azure AD.
On the front page within the SaaS solution, user clicks on a widget which opens up a modal window.
Ajax call (POST) (bootstrap-table) is made which calls a php-script from another domain.
PHP script receives ajax request (CORS settings are ok). Here is where I would like the script to perform a silent user authentication against Azure AD and return user's email. It should not in any way display any login-screens or account selection screens. If the authentication fails it should just exit... perhaps with a error message.
Once authenticated, php-script performs API call(s)
On successfull call, JSON data is returned
And JSON returned from PHP-script is displayed on front page (bootstrap-table).
I've been trying with various examples/libraries (thephpleague/oauth2-client, magium/active-directory, ...) and I'm able to authenticate fine via Azure AD App but there is always a login-screen present or select account screen is displayed.
The reason for this approach is that I believe CORS are not secure or perhaps should not be used as a security measure. And also, because some browser does not seem to return Origin I am experiencing some issues...
Now, I'm more of a hobby-developer and perhaps this is in no way possible to achieve but I would like to believe it is and would appreciate any tips/hints on how to perform this silent activity/authentication.
Thank you!

Developing REST API using PHP

I am new in API. I am supposed to develop an API that allows our content provider to give information pertaining soccer whereby he is supposed to create matches,update matches etc .I would like to know how to create a REST API in php that allows a client to enter the information. So far,I have created an API but I dont know how to enable the client enter the information.
Informations:
It is the basic form that you have to create and then you must allow the user to submit the form datas that he/she has filled and you have to post the data to the route that you have created.
You must submit the data and then you have to make the submitted data to be json_encode() so that it will work for the API.
Or Else if you are not designing the form and other such things you can directly go in for the API ADD ONS that the Firefox and the chrome has . Assuming you are using the chrome or Firefox as browsers.
https://addons.mozilla.org/en-US/firefox/addon/restclient/
https://addons.mozilla.org/en-US/firefox/addon/rest-easy/
https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
Okay, assuming that you created a REST API already, download the Advanced REST client chrome extension: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
I hope that answers to your question.
P.S: May I know what framework did you use to design your REST API ? Additional details can help you further.
Building REST APIs is atually a rather easy task. That's primarily what I work on at work all day. If you have to use PHP (I'm a fan of PHP, so don't take that comment the wrong way :) ), I would reccommend using a framework like Laravel.
The logic to handle the information once it's requested wouldn't change. You would just need to make your requests/responses REST compliant.
Here is a great tutorial for doing just that!
Also, since you use Yii, this tutorial is probably better. I've never used Yii, so I can't really vouch for it, though.

Upload directly to Vimeo via form

I need to know a method to upload a video to a VIMEO PRO account using a form and PHP (to get auth). Currently I can send a video directly to Vimeo, using the panel, as was to be expected. But I have some clients that want to upload your videos directly from my their control panel (created by me), outside of vimeo, and I have only a unique PRO account, and I can't share the account data.
Seems that I can do it, based on the page API https://developer.vimeo.com/apis/advanced/upload#post (Uploading via POST).
My doubts are:
Can I really do that, without pass to my clients the Vimeo PRO account data?
It's a secure method (considering that clients respect the agreement with Vimeo)?
I need to upload DIRECTLY to Vimeo, without pass to my server, because I'll have two works: one to upload to server, other to upload from server to vimeo.
Off-topic: I believe I will not have problems with Vimeo, since they are customers of one company, and the account belongs to the company, and the videos will be her responsibility.
How should work
User access my panel, with your credentials;
User access the video upload page;
Probably the server will contact Vimeo to get an uploader auth;
User will select your vimeo file and submit form;
System will receive the vimeo ID and everyone will be happy forever.
Thanks!
Edit: This feature is now supported by Vimeo's (in beta) API3. You can request access at https://vimeo.com/help/contact
The below information is still accurate in regards to the Advanced API
This feature is not reliably supported by the advanced api.
The primary issue is that with client side uploads, there is no way to tell the upload server what to do once the upload is complete. Additionally, there is no client side technique to find out whether the upload has completed
You might be able to cheat and have the user upload through an iframe, and have the primary page perform a verify chunks call every couple of seconds. I have not tried this, at the moment it is just a theory. If you attempt this hack, Vimeo would love to know more via their contact page https://vimeo.com/help/contact
The feature you are discussing is on the roadmap for the next version of the API, and an early imperfect version was available at their API Hackday. It might be a better idea to hold off a bit and wait for the official feature.
NOTE: This observation does NOT apply to server side uploads. Because the whole upload process is handled via code on the server, it is extremely easy to tell when an upload is complete.
Answering in 2016: Assuming you have already retrieved an access token from Vimeo (OAuth2) this is a good piece of code to help you create an upload form:
https://github.com/websemantics/vimeo-upload
This gives you the code for the form with a place to drag-drop your video file and calls the upload API:
If you're using WordPress, there is a plugin available that allows you to do just that
http://vimeography.com/add-ons/vimeography-upload/
Source: I made it :)

zend - upload file with REST services

i use zend framework and work with some web services(insert, update, delete but with int, string parameters). Now i don't how to upload file(for example image) with zend and web services(REST). Does anyone have some example?
You should send the file throught post call. The Rest service will receive the postAction as when you do what ever other functions. But, with files you cannot make the calls with ajax, so you have a little trick to do in client side.
Remember, REST service will implement post action and receive the parameters as you would receive normally. If you know how to receive and manipulate a file with standard php, you can do it in REST service implementation.
The trick on client side is to create an invisible iFrame and redirect the submit form target to it.
This links explain this method very well with code samples:
form POST in iframe without affecting history
http://ajaxpatterns.org/IFrame_Call
http://geekswithblogs.net/rashid/archive/2007/08/01/Create-An-Ajax-Style-File-Upload.aspx
http://www.openjs.com/articles/ajax/ajax_file_upload/
http://viralpatel.net/blogs/2008/11/ajax-style-file-uploading-using-hidden-iframe.html
NamastĂȘ !!

Categories