Getting error "The required field Extension is missing from the input structure." when trying to update a report datasource using SSRS Rest API - sql-server

I am trying to update an existing report to use a shared datasource using the SSRS Rest Api v2. I am getting the error back "The required field Extension is missing from the input structure." Error code 1008. I have not been able to figure out what needs to be in the request. I have tried the examples in the api documentation to no avail. Has anybody experience this? Below is the request I am sending.
URL: http://reportserver/reports/api/v2.0/reports({reportid})/DataSources
Method: PUT
Json data:
[{"Id":"4252a76c-3117-4c33-a4ce-361c3dfcc602", "Name":"DataSource1","Path":"/Test/Data Sources","Type":"DataSource","IsReference":false}]
I understand it is looking for something in the payload but I can not figure out what is missing. "Extension" isn't a field listed in the api documentation.

Related

Azure AD B2C Custom Policy Localized REST API Conflict Response

This is sort of an extension of this question here. I have a policy that calls a REST API. The API returns an error message and this message needs to be localized.
One way is to of course get the API to return a localized message, but is there a way for the CustomPolicy itself to localize the error code? According to the CustomPolicy Docs, a REST API can send an error code along with the Conflict error code. Our thinking was to use this error code as a key and select a localized message (from the messageValue enum mentioned in the answer in the link).
However, we can't seem to capture/handle the error data returned by the API. The Policy seems to handle error codes by itself and we would like to know if it is possible to inject localized exception/error messages from the policy itself.
Thanks in advance!
Edit: A little more information about the setup. We have a TechnicalProfile that has a DisplayWidget and a ValidationTechnicalProfile. The DisplayWidget is used for entering & verifying the user's phone/email and the ValidationTechnicalProfile makes the final call to the RestAPI with all the user's information to register him/her. This RestAPI call output is what we want to localize.
The suggestion in the linked SO question, from what I understand, is that we integrate another DisplayClaim (that references an enum) in the DisplayWidget, and depending on the ErrorCode returned by the call, change it to display the appropriate code. However, as per my understanding, this would also require editing the API to return only 200 along with a code. This code would indicate the true nature of the result - success or a code for one of the enums to be displayed.
Our aim therefore is to check if there is a way to follow the Policy's flow (disrupt the SignUp/SignIn process) but at the same time localize the API's displayed response.
We managed to find a workaround to this, so I'm posting this here for anyone else who might be interested in this.
Our restriction for localizations was the fact that used Phrase to manage our translations and wanted the CustomPolicy specific translations all in one place. Our CD workflow was as follows:
PolicyCommit -> Build Variable Replacement through PS -> Release Variable Replacement and localized strings replacement through PS & Policy Uploads
Barring the policy from localizing the APIs response, we had the following options to achieve this:
Sending the language to the API and having the API return the appropriate error message
in the appropriate language. We were reluctant to follow this because of a multitude of reasons, but mostly because we would also have to handle different regions, etc. in the API - something the policy does by itself.
We actually had only one API that we called, and also only two error messages that were used. Hence we created an enum with the two error messages that would be localized. We then used a chain of InputClaimsTransformations that did the following:
Repeat Steps 1 through 3 for all the errors
1. CreateStringClaim (Create ClaimTypes for each of the error codes, holding the index of the error code in the enum)
2. GetMappedValueFromLocalizedCollection (Make the localized enum choose and hold the value of the required error code)
3. AddItemToStringCollection (Add the localized error from the enum to a StringCollection)
4. GenerateJson (Add the error codes StringCollection to the JSON payload to be sent to the API)
This way, the policy performed the localization for all the errors and we sent them along with the request to the API. The API, when an error occurred, picked one of the error messages from the policy and sent it back. This method was for us, because of our CD structure and Phrase integration, much easier than actually having the translations in a file hosted on the cloud to be accessed by the API.
Hope this helps someone; I can also add code in case someone needs it :)

Get all-time-impressions for given contentName in Matomo Reporting API

I'd like to request the core metrics for a given contentName in matomos reporting API. ContentName is in this example anwalt:4247, and I send this request:
https://statistics/?method=Contents.getContentNames&segment=contentName==anwalt:4247&label=anwalt:4247&date=2019-01-01,today&period=range&format=JSON&module=API&idSite=1&format=JSON&token_auth=93exx3
gives
[{"label":"anwalt:4247","nb_visits":27,"nb_impressions":37,"nb_interactions":12,"sum_daily_nb_uniq_visitors":27,"interaction_rate":"32,43\u00a0%","segment":"contentName==anwalt%3A4247","idsubdatatable":1}]
or this
https://statistics/?method=Contents.getContentNames&label=anwalt:4247&date=2019-01-01,today&period=range&format=JSON&module=API&idSite=1&format=JSON&token_auth=93exx3
gives
[{"label":"anwalt:4247","nb_visits":21,"nb_impressions":28,"nb_interactions":8,"sum_daily_nb_uniq_visitors":21,"interaction_rate":"28,57\u00a0%","segment":"contentName==anwalt%3A4247","idsubdatatable":282}]
But both numbers are wrong (other than in matomo UI).
Isn't there any simple request for that common task?
What you tried with &date=2019-01-01,today&period=range should work fine, what is the problem in the output data?

Request data from JSON API and store in SQL Server using SSIS

I'm trying to request data from a JSON API from Vemcount - a footfall-sensor system. I want to retrieve all my company's data and store it in a SQL Server db using SSIS. During my research I've realized that JSON is not natively integrated with SSIS, so solutions are either hardcoding the import or using a 3rd party - I've chose to go with the latter, so currently I'm trying to do the request using Kingswaysoft and their JSON Source component in VS.
The URL looks something like this (example from their documentation, which can be found here):
https://login.vemcount.com/api/fetch_data/?data={"api_key":"xxxxxxx","type":"shop_id","id":[10,14,24],"date_from":
"2014-01-01 00:00","interval":"15min"}
So, the keys api_key, type, and id are mandatory. The key/value pairs "type":"shop_id" and "id":[10,14,24] are the type of ID I want to search on and the ID itself. In the above example I've entered 3 different shop_id's. However, we have more than 250 id's, and more are being added continuously.
How do I request ALL the different id's without adding all the id's in the array? I've pasted my HTTP CM and JSON Source Editor below.
As you've probably guessed by now, this is somewhat unexplored territory for me, so I'm aware I might have chosen to proceed in a completely wrong way. If you have any better solutions for my case, please let me know.
UPDATE: So I've stored all Shop ID's in a variable, which I wanna pass as a value.
I am answering on phone so I don't have ssis available but here are the steps id do.
Exec sql to get the list of shop ids saved into an object.
For each loop on ado object from 1 storing shop id into variable.
Data flow
Script component source passing in shop ID as variable.
Build your url.
Using web client download string.
Deserialize JSON and write to data flow to finish.
Step 7 is huge and requires its own question. It involves setting up classes for your json.
This should get you started. Research step7 before posting question though.
Good luck.
Also, here is a link to help I received in regards to deserializing JSON.
C# Checking if Object is Null

Getting all entries from a database that start with letters using HTTP request

I am writing a simple filter function that sends a request and gets all entries that partially match the query. Desired behavior is if do a GET request localhost:3000/employees?email=mai I would like to receive all entries from a database starting with mai. Is there any way to construct an http requests for the desired behavior from a front-end part of the application? Perhaps some headers that tell the server that the search should not be strict? I have tryed googling it but failed. I am using AngularJS fro front-end and json-server as a back-end mock server
Up to my understanding if you filter data in front End you will get only that data filtered which you are showing. In the other hand If you do this using Query(Back End) all the data get filtered in DB.

How do you get the groupUniqueId for the Google Group Settings API?

I am looking at this API: https://developers.google.com/admin-sdk/groups-settings/v1/reference/groups/get
However, when I try the test at the bottom, it always returns 400 Bad request. I have tried using the Google group email address (without the #gmail.com and with the #gmail.com) for several groups I am in.
How do you find the groupUniqueId for a Google group?
I had the problem yesterday and 'think' I undertood it:
I use the PHP SDK and had to use groupssettings API.
When I executed my query, the PHP answer was something such: "incorrect json format".
Still in my API, I had to FORCE the JSON to be used, by adding optional parameter: alt=json
Then, The query worked.
Until now, this is the only Google API where I had to specify this.
What I suspect is the "Try It" feature to use json, and because the API does NOT returns json by default, it just fails. Too bad there is no way to force json there.

Resources