azureStorageUri not created when create mobileAppContentFile in Microsoft Intune - azure-storage

I want to create a mobileAppContentFile. For this I make a POST request to:
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/0122f94e-45c4-458a-a25a-c08135a036fc/microsoft.graph.windowsMobileMSI/contentVersions/1/files
with this request body:
{
"#odata.type": "#microsoft.graph.mobileAppContentFile",
"azureStorageUri": "https://NAME.blob.core.windows.net/intune/TestApp.msi",
"name": "TestApp.msi",
"isCommitted": false,
"uploadState": "azureStorageUriRequestPending"
}
I receive 201 Created response but azureStorageUri is null:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#deviceAppManagement/mobileApps('0122f94e-45c4-458a-a25a-c08135a036fc')/microsoft.graph.windowsMobileMSI/contentVersions('1')/files/$entity",
"azureStorageUri": null,
"azureStorageUriExpirationDateTime": null,
"createdDateTime": "0001-01-01T00:00:00Z",
"id": "ca57173c-5f67-4048-90bf-3bac136de964",
"isCommitted": false,
"manifest": "bWFuaWZlc3Q=",
"name": "TestApp.msi",
"size": 0,
"sizeEncrypted": 0,
"uploadState": "azureStorageUriRequestPending"
}
What could be the problem?

Fisrt,as #Marc Lafleur said, you need to upload the file to Azure sotrage first and then provide the required Property value of them.
Second,In your request body, you didn't fill with full required properties.
Follow this example to create one mobile app content file :
POST https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/{mobileAppId}/contentVersions/{mobileAppContentId}/files
Content-type: application/json
Content-length: 342
{
"#odata.type": "#microsoft.graph.mobileAppContentFile",
"azureStorageUri": "Azure Storage Uri value",
"isCommitted": true,
"name": "Name value",
"size": 4,
"sizeEncrypted": 13,
"azureStorageUriExpirationDateTime": "2017-01-01T00:00:08.4940464-08:00",
"manifest": "bWFuaWZlc3Q=",
"uploadState": "transientError"
}

Related

LinkedIn Share API creates a share but returns error 500

I'm asking this question on SO, since LinkedIn support is officially moved here.
I'm receiving HTTP 500 response from LinkedIn API endpoint while trying to create a share. This happens sporadically, but it is a quite often event last week or two. The weird part is that the share being created successfully.
Please advise. Could it be caused by spiking users activity on social media due to COVID19?
For the reference, here is request body POST-ed to https://api.linkedin.com/v2/shares (real ids are replaced).
{
"owner": "urn:li:organization:111111",
"text": {
"text": "Text text text"
},
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:111111"
}
],
"shareMediaCategory": "IMAGE"
},
"distribution": {
"linkedInDistributionTarget": {
"connectionsOnly": false,
"visibleToGuest": true
}
}
}
Response:
{
"message": "Internal Server Error",
"status": 500
}

Keycloak - using admin API to add client role to user

I'm triyng to use keycloak AdminAPI (https://www.keycloak.org/docs-api/3.0/rest-api/index.html#_users_resource) to create user and assign client roles. I'm receiving correct token, and user is created but assigning roles return 404
I'm using Postman to connect with API:
/auth/realms/{realmName}/protocol/openid-connect/token
Content-Type application/x-www-form-urlencoded <-with parameters ofc
/auth/admin/realms/{realmName}/users
Content-Type application/json
Authorization Bearer {TOKEN}
Body:
{
"username": "name",
"enabled": true,
"emailVerified": false,
"firstName": "first",
"lastName": "last",
"credentials": [
{
"type": "password",
"value": "newPas1*",
"temporary": false
}
]
}
Above works for me, but the next one don't
/auth/admin/realms/{realmName}/users/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/role-mappings/clients/realm-management
Content-Type application/json
Authorization Bearer {TOKEN}
Body:
{
"roles": [
{
"id": "0830ff39-43ea-48bb-af8f-696bc420c1ce",
"name": "create-client",
"description": "${role_create-client}",
"composite": false,
"clientRole": true,
"containerId": "344e7c81-e7a2-4a43-b013-57d7ed198eee"
}
]
}
where 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx' is userID returned during creation and create-client role exists
I need a way to add client role via Http request. I saw there are some keycloack implementation for java but I'm using .NET CORE so there will be the target implementation but I need to have working request first as you may gues
You have to pass client UUID to the role-mappings REST method, not the ID that you specify when creating a client in admin UI. Use GET /admin/realms/{realm}/clients?clientId=realm-management REST method to find out the client UUID.
UPDATE
In Keycloak 6.0.1 to add a role it is required to pass role name and id.
Example:
POST /auth/admin/realms/{realm}/users/{user}/role-mappings/clients/{client}
[
{
"id": "0830ff39-43ea-48bb-af8f-696bc420c1ce",
"name": "create-client"
}
]

Why can't I create a managed device on Intune?

I am trying to create a managed device in Intune but I am getting different errors.
This is the documentation I am using https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/intune_devices_manageddevice_create.
I am testing the functionality using Graph Explorer so I do not need the authorization token and the account I am logged into is the global administrator and has the appropriate delegated permission enabled 'DeviceManagementManagedDevices.ReadWrite.All'.
When I try the first request /users/{usersId}/managedDevices I get a 403
An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000.
If I try /deviceManagement/managedDevices I get 400
No OData route exists that match template
I am signed up for a free trail for Intune and Azure AD if this makes any difference.
What could I be missing?
The request body I based off the example in the documentation for create managedDevice. I also tried removing the odata type but it makes no difference.
An example I have tried
{
"id": "5h5b3fab-0169-45de-9aad-3d928ebbe1a0",
"userId": null,
"deviceName": "newIntuneDev",
"deviceActionResults": [],
"enrolledDateTime": "2018-02-19T11:04:24.242385Z",
"lastSyncDateTime": "2018-01-03T14:01:45.1553437Z",
"operatingSystem": "Android",
"complianceState": "compliant",
"jailBroken": "false",
"managementAgent": "mdm",
"osVersion": "7.0",
"easActivated": true,
"easDeviceId": "DFC17B28459230B3",
"easActivationDateTime": "2018-01-19T11:05:11.4483412Z",
"azureADRegistered": true,
"deviceEnrollmentType": "userEnrollment",
"activationLockBypassCode": null,
"emailAddress": null,
"azureADDeviceId": "89f65205-72af-4830-a9b1-ebcd3160476f",
"deviceRegistrationState": "registered",
"deviceCategoryDisplayName": null,
"isSupervised": false,
"exchangeLastSuccessfulSyncDateTime": "0001-01-01T00:00:00Z",
"exchangeAccessState": "none",
"exchangeAccessStateReason": "none",
"remoteAssistanceSessionUrl": "",
"remoteAssistanceSessionErrorDetails": "",
"isEncrypted": false,
"userPrincipalName": null,
"model": "SM-G930F",
"manufacturer": "samsung",
"imei": "539467078998547",
"complianceGracePeriodExpirationDateTime": "9999-12-31T23:59:59.9999999Z",
"serialNumber": "T58H52RP9KN",
"phoneNumber": null,
"androidSecurityPatchLevel": "2018-01-01",
"userDisplayName": null,
"configurationManagerClientEnabledFeatures": {
"inventory": false,
"modernApps": false,
"resourceAccess": false,
"deviceConfiguration": false,
"compliancePolicy": false,
"windowsUpdateForBusiness": false
},
"wiFiMacAddress": "4C6641183631",
"deviceHealthAttestationState": null,
"subscriberCarrier": "",
"meid": "659467078998547",
"totalStorageSpaceInBytes": 0,
"freeStorageSpaceInBytes": 0,
"managedDeviceName": "newDevice",
"partnerReportedThreatState": "unknown"
}
This (https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/intune_devices_manageddevice_create) is a documentation error. API does not support creation of managedDevice. You would need to MDM enroll a device into Intune to see data populated under ~/managedDevices API.
Signup for a free Intune trial subscription
Set MDM authority - https://learn.microsoft.com/en-us/intune/mdm-authority-set
Enroll a device -
https://www.microsoft.com/itshowcase/Article/Video/634/Enroll-your-mobile-device-in-Microsoft-Intune-for-corporate-access
Once successfully enrolled, device should show up under ~/managedDevices
Thanks,
Alemeshet Alemu - MSFT

how to get users data who replies,plusoners and resharers any google plus page?

I have used this api
https://www.googleapis.com/plus/v1/people/page-id/activities/public?key=app-id
and getting all public data of a particular google plus page and in that same json structure i get this
"replies": {
"totalItems": 0,
"selfLink": "googleapis.com/plus/v1/activities/replies-id/comments"
},
"plusoners": {
"totalItems": 1,
"selfLink": "googleapis.com/plus/v1/activities/plusoners-id/people/plusoners"
},
"resharers": {
"totalItems": 0,
"selfLink": "googleapis.com/plus/v1/activities/reshare-id/people/resharers"
}
But when I call one of the above api i get this :
"code": 403 "message": "Daily Limit for Unauthenticated Use Exceeded.
Continued use requires signup."
Make sure you add your APIkey to the end of each of the URLs.
googleapis.com/plus/v1/activities/plusoners-id/people/plusoners?key=app-id

How to get track ID from URL using the SoundCloud API

How can I get a track ID from a track URL using the SoundCloud API?
You didn't specify a language in your question, so I'm just going to provide a high-level answer.
Use the resolve endpoint. I'm using this URL as an example:
https://soundcloud.com/msmrsounds/ms-mr-hurricane-chvrches-remix
HTTP GET: https://api.soundcloud.com/resolve.json?url=https%3A%2F%2Fsoundcloud.com%2Fmsmrsounds%2Fms-mr-hurricane-chvrches-remix&client_id=[your_client_id]
The resulting JSON:
{
"status": "302 - Found",
"location": "https://api.soundcloud.com/tracks/147986343.json?client_id=[YOUR client_id]"
}
That numerical value is the track_id. You can just stop here or hit that endpoint you just got back for more information:
{
"kind": "track",
"id": 90787841,
"created_at": "2013/05/05 00:15:40 +0000",
"user_id": 7853935,
"duration": 188333,
"commentable": true,
"state": "finished",
"original_content_size": 35031144,
"last_modified": "2014/09/30 05:53:10 +0000",
"sharing": "public",
"tag_list": "MSMR CHVRCHES \"Secondhand Rapture\" Remix Hurricane",
"permalink": "ms-mr-hurricane-chvrches-remix",
"streamable": true,
"embeddable_by": "all",
"downloadable": true,
"purchase_url": null,
"label_id": null,
"purchase_title": null,
"genre": "",
"title": "MS MR - Hurricane (CHVRCHES remix)",
"description": "MS MR - Hurricane (CHVRCHES remix)\r\n\r\n\r\n",
"label_name": "",
"release": "",
"track_type": "",
"key_signature": "",
"isrc": "",
"video_url": null,
"bpm": null,
"release_year": null,
"release_month": null,
"release_day": null,
"original_format": "wav",
"license": "all-rights-reserved",
"uri": "https://api.soundcloud.com/tracks/90787841",
"user": {
"id": 7853935,
"kind": "user",
"permalink": "msmrsounds",
"username": "MSMR",
"last_modified": "2014/08/04 09:03:56 +0000",
"uri": "https://api.soundcloud.com/users/7853935",
"permalink_url": "http://soundcloud.com/msmrsounds",
"avatar_url": "https://i1.sndcdn.com/avatars-000037198343-2lptmy-large.jpg?86347b7"
},
"permalink_url": "http://soundcloud.com/msmrsounds/ms-mr-hurricane-chvrches-remix",
"artwork_url": null,
"waveform_url": "https://w1.sndcdn.com/56LCadzDEBZn_m.png",
"stream_url": "https://api.soundcloud.com/tracks/90787841/stream",
"download_url": "https://api.soundcloud.com/tracks/90787841/download",
"playback_count": 1672227,
"download_count": 18494,
"favoritings_count": 20426,
"comment_count": 464,
"attachments_uri": "https://api.soundcloud.com/tracks/90787841/attachments",
"policy": "ALLOW"
}
Since the SoundCloud API is indefinitely not accepting new registrations, here's one alternative solution. This URL will provide you with a wide/short embedded player:
https://w.soundcloud.com/player/?url= + URL of track
Example: https://w.soundcloud.com/player/?url=https://soundcloud.com/chrisbjerken/picking-up-the-pieces
This works for both a single track or a playlist.
So my final code looks like this. Thank you guys for the help to get this working.
include_once('../Services/Soundcloud.php');
$client = new Services_Soundcloud('CLIENT_ID', 'CLIENT_SECRET');
$track_url=$_POST['trackurl'];
$track_url=str_replace("https://soundcloud.com/USERNAME/","",$track_url);
$track = json_decode($client->get("tracks/".$track_url));
$track_id=$track->id;
echo $track_id;
In The Meantime Writing This Answer The CLIENT_ID Is Close
Due to the high amount of requests recently received, we will no longer be processing API application requests at this time. We are working to re-evaluate our process to make it more efficient.
See Here
I Solved This Issue With My Laravel Project Like This
first I Made This Function To Get The Real Content
public function getLessonUrl($lessonId = null)
{
//Get the SoundCloud URL
$validUrl = 'https://soundcloud.com/al-hazme';
$result = stripos($lessonId, $validUrl);
if (strpos($lessonId, $validUrl) !== false) {
//Get the JSON data details with embed code from SoundCloud oEmbed
$getValues = #file_get_contents('http://soundcloud.com/oembed?format=js&url=' . $lessonId . '&color=%234274e3&auto_play=false&hide_related=true&show_comments=false&show_user=false&show_reposts=false&show_teaser=true&show_artwork');
if ($getValues === false) {
return 'حدث خطأ اثناء تحميل الدرس نرجو منك التأكد من اتصال الانترنيت لديك او حدث الصفحة';
}
//Clean the Json to decode
$decodeiFrame = substr($getValues, 1, -2);
//json decode to convert it as an array
$jsonObj = json_decode($decodeiFrame);
//echo $jsonObj->html;
$lessons = str_replace('height="400"', 'height="90"', $jsonObj->html);
return $lessons;
} else {
return 'لايوجد استماع لهذا الدرس';
}
}
Then I Made Another Function To Crap The Id Using Str Facade Methods
use Illuminate\Support\Str;
public function soundCloudId($url) {
$do = $lesson->getLessonUrl($lesson->url_link);
$getTrickId = Str::after($do,'tracks%2F');
$substr = Str::substr($getTrickId,0,9);
echo $substr = // 367893857
}
It May Help Or Give You Clue
I know this is kinda late but i faced the same issue yesterday and found a new (undocumented) endpoint that you can use.
https://api-widget.soundcloud.com/resolve?url=SOUNDLCOUD_URL&format=json&client_id=CLIENT_ID
You can find your CLIENT_ID by looking at the Network Inspector in the DevTools and select the XHR filter while browsing the SoundCloud website.
I think this is sufficient until the official APIs are usable again.