How to get the file id using Box API - configuration

I have created created How to a new web app integration with the help of this documentation of Box api documentation.
When i right click on a pdf file i can see my application.
Now i need to know how to configure my application to get the file id?

I believe what you're looking for is the "Callback Parameters" section of your Web App Integration.
Within the Callback Parameters section you can choose whether what your application is expecting is a GET or POST request or a file object (in cases where you would like the file itself to be sent to your application) and input a parameter name that you would like to receive for the value. Then you can click into the box for Parameter Value to see a dropdown of the available parameters that can be sent to your application with a short description of what each one returns. The one you're looking for in this case is the file_id, which will show up as #file_id# once you click it, as in the screenshot provided.

Related

Google Data Studio Community Connector: Passing Token Through Embed URL Not Working

I'm struggling to get a community connector to work for a web-app I'm building.
I wrote a very basic connector in App Script to do row level filtering on an embedded dashboard, using these docs Google provides: https://developers.google.com/datastudio/solution/viewers-cred-with-3p-credentials
My connector uses getConfig() and getData() to pass a token into an API endpoint, and that API endpoint returns data specific to that user.
The connector works perfectly when I pass in a token in the GUI by modifying the configuration, but doesn't work when I try to pass in the token using the embedded url.
Example 1
User Token = 5wKu4QLvc9PC7tkPyg
Steps:
Click "Edit connection"
Enter token in input field [which is generated by getConfig() in app script]
Click "Reconnect"
Click "Apply" on dialogue box that comes up
Google Data Studio correctly retrieves 3 rows of data for this token
Example 2
User Token = z6ps6Vhb9hzB333gG4
Steps:
Click "Edit connection"
Enter token in input field [which is generated by getConfig() in app script]
Click "Reconnect"
Click "Apply" on dialogue box that comes up
Google Data Studio correctly retrieves 1 row of data for this token
The primary issue
When I use the embed URL for the dashboard, I noticed the App Script execution logs aren't showing that getConfig or getData operations are being run.
The end result is the token doesn't appear to be passed into the embed URL at all. The data remains the same as in the GUI-based report.
However I can tell the embed URL is being invoked, because it does call getAuthType in the App Script execution logs, see image below. (I made the change in the GUI at 9:50:59 PM, and then the subsequent timestamps are me attempting to hit the embed URL)
Sample
Here's the sample of the actual embed URL I'm using:
https://datastudio.google.com/embed/reporting/9dea8b8a-5b51-4add-adb2-afda3861b241/page/VXkvC?config=%22%7B%5C%22token%5C%22:%20%5C%22z6ps6Vhb9hzB333gG4%5C%E2%80%9D%7D%E2%80%9D
Per the Example 2 above, the token being used in this embed URL should only return 1 row of data, but it's returning all 3.
I followed the Google docs, which suggest this is the format to use: https://datastudio.google.com/embed/reporting/[report_id_here]/page/[page_id_here]?config="{\"token\": \"[token_here]\”}”
I'm wondering if it's possible the Google docs are incorrect (or) out of date and my embed url is malformed? I can't get my head around this issue.
Resolution
Despite being part of the getConfig(), apparently you also have to "Add a Parameter" for the token to your Data Source on the report. This will result in the parameter being visible under all fields.
Next, go to Resource > "Manage report url parameters" and check the box for "Allow to be modified in report URL". Take note of the "Name" field. Mine was ds0.token
Finally, use this URL syntax: https://datastudio.google.com/embed/reporting/[report_id_here]/page/[page_id_here]?params=%7B"[name_from_step_2]":"[value]"%7D
Which for me translated into:
https://datastudio.google.com/embed/reporting/9dea8b8a-5b51-4add-adb2-afda3861b241/page/VXkvC?params=%7B"ds0.token":"12345"%7D
Which in raw URL format looks like:
https://datastudio.google.com/embed/reporting/9dea8b8a-5b51-4add-adb2-afda3861b241/page/VXkvC?params=%7B"ds0.token":"12345"%7D
One additional observation. I was watching the logs on my API endpoint, and I noticed Google caches any data it brings back from the endpoint. So don't be surprised if you don't see a getData() call in your App Script execution logs for any tokens you've already passed. Just make up a new token to see a new getData execution log.

Parameter pass in telerik reporting by web service data source

dear all I am trying to develop a Telerik report and its data source is web service data source.
I complete all process according to Telerik reporting instruction and it can access my service initially. and pass parameter value as well as but when I click finish but to complete adding by data model it again hit my backend and pass parameters name not value.
please help me out from this trouble. it already kill my day.
for more reference please see the attached image.
Initiation step 1:
parameter assign:
Backend receive parameter when i press download button correctly.
according to parameter retrieve data:
But finally when click finish button it hit again in backend and backend receive the parameter value like this. and this is the main problem.
I hope I can explain. please help me from this trouble.

Can I embed Google Image search into my html5 webpage

What I would like to be able to do is for user to click button on my website (actually a webapp that runs locally on user machine so each instance is single user) which initiates a Google image search with various params set and display the results in a section of my html page.
This is because the idea is they can then select an image and drag and drop it onto a dropzone on my webpage. This parts works but currently the search is opening in a new tab so its a bit of a pain dragging from that tab to my tab.
Embedding as an iframe does not work, Google does not allow that.
So
a> is there a Google sanctioned API I can use to perform a Google search for images and display within my page.
b> Could I send send a url request from my server (i,e like curl/wget and then screenscrape the results and present on webpage
Google's Custom Search Engine (CSE) API is limited to 100 free requests per day.
Creating cx and modifying it to search for images
Create custom search engine at https://cse.google.com/cse/create/new based on your search criteria.
Choose sites to search (leave this blank if you want to search the entire web, otherwise you can enter a site to search in one particular site)
Enter a name and a language for your search engine.
Click "create." You can now find cx in your browser URL.
Under "Modify your search engine," click the "Control Panel" button. In the "edit" section you will find an "Image Search" label with an ON/OFF button, change it to ON. Click "update" to save your changes.
Conducting a search with the API
The API endpoint url is https://www.googleapis.com/customsearch/v1
The following JSON parameters are used for this API:
q: specifies search text
num: specifies number of results. Requires an integer value between 1 and 10 (inclusive)
start: the "offset" for the results, which result the search should start at. Requires an integer value between 1 and 101.
imgSize: the size of the image. I used "medium"
searchType: must be set to "image"
filetype: specifies the file type for the image. I used `"jpg", but you can leave this out if file extension doesn't matter to you.
key: an API key, obtained from https://console.developers.google.com/
cx: the custom search engine ID from the previous section
Simply make a GET request by passing above parameters as JSON to the API endpoint (also listed above).
Note: If you set a list of referrers in the search engine settings, visiting the URL via your browser will likely not work. You will need to make an AJAX call (or the equivalent from another language) from a server specified in this list. It will work for only the referrers which were specified in the configuration settings.
Reference:
https://developers.google.com/custom-search/json-api/v1/reference/cse/list
Answer from: https://stackoverflow.com/a/34062436/4366303
Google has retired the image search API, it is no longer available (see this SO thread with alternatives).
If you open up the URL you provided it will say this:
{"responseData": null, "responseDetails": "This API is no longer available.", "responseStatus": 403}

Access data from an actual API service in protractor tests

I am writing end-to-end tests using Protractor for an Angular application. The application uses an API service to retrieve data from the back-end and this data is then used to populate pages in the Angular application.
I would like to utilize this API to get data to use in my jasmine tests, the tests will confirm that the back-end data is correctly and completely populated on applicable pages in the UI. I definitely DO NOT want to mock the server, I want to hit the actual server and work with the actual data from the JSON response.
My question is 2 sided; how to call the API service from my protractor tests and secondly, how to retrieve data from the JSON response from this API.
Any (detailed) information, examples you can provide as to how this can be done would be appreciated
Thanks in advance.
Protractor is used to test the ui of an application. What it does is click buttons and enter text in text boxes and wait for responses. For example if I have a login form and want to test the scenario when a user enters an email address wrong and an error message pops up. Protractor would navigate to the email field, enter an incorrect email address and then find the element that contains the error and verify the error showed up.
So as long as you have an environment setup that has a ui connected to an API service, the API service will be called as normal. Protractor will click buttons and if a button click triggers a call to the API service it will go straight to that service.
As for the JSON response access, this is probably not a good use for protractor. Protractor is used to click events and wait for responses. So if you are displaying that JSON response in some form or way protractor could verify it is displayed. For example, if you are displaying some data from the server in a table on a button click, you could have protractor click that button and verify the table has the correct values. But you would not want to verify the JSON object is as expected. That would be unit-tests on the API itself.
Hope this helps.
We have two options
Make a request by require(...) and using a request library.
This allows you to make direct HTTP Service calls, as discussed in this Stack Overflow post
Use some data from a .json file by require(...) it directly:
https://github.com/angular/protractor/issues/978#issuecomment-47250364

Reading file content based on Box Webhooks Events

I want to develop an app that listens to Box Webhooks events for a file create or upload event, and then reads the content of that newly created/uploaded file.
However, I am not able to do so because as far as I understand I need an access token to be able to read contents of a file, but the Box Webhooks [create/upload] event does not provide me with any access token.
Could you please suggest a way using which I can implement my app?
Webhooks are kinda like a postcard. They only give you the bare minimum of info to tell you what file has changed. They're being sent over the wire to an unauthenticated destination, so when a webhook goes out, it can't have a lot of secret information already in it.
It's up to you to catch that webhook, look at the file-id (and potentially some other info, like the user-id) and know what user to have login and get the additional information.
If your application is server-side, and the users have signed in, then you'll already have their credentials, and you can go get the extra info.
If your application is a mobile app with no server side, then you will have to have the client make the extra API calls to get the details.