I'm using the wikimapia api for developing an Android application. I've used my first key for about two months but not, for any request I make I get:
{
"debug": {
"code": 1004,
"message": "Key limit has been reached"
}
}
I've created a new key, but now, for any request I make I get the same response: []
Does anybody know what the problem is?
It looks like something wrong on Wikimapi side. It returns me [] too.
There are few post about this issue on wikimapia forum
http://wikimapia.org/forum/viewtopic.php?f=4&t=14933&p=288045&hilit=empty#p288045
Related
I created 2 policies in my enterprise.
I would like to switch one device to the other policy without re-enroling it.
I tried to use android management enterprises devices.patch with following JSON
{ "policyName": "policy2" }
this link
When i execute this command i always get follwoing error Message:
{
"error": {
"code": 400,
"message": "Illegal state transition from ACTIVE to DEVICE_STATE_UNSPECIFIED",
"status": "INVALID_ARGUMENT"
}
}
Does anybody know how to change policy for a device without wiping it?
It is indeed possible to change the policy of a device without re-enrolling it, and you're not far from the solution.
You get this error because you implicitly attempt to change other fields of the Device resource (in particular the state field) by not setting them in the resource that you send in devices.patch.
You have two options:
Set the updateMask in devices.patch to "policyName", to tell the API that you only want to change the policyName field.
Call devices.get to get the current Device resource, and then send back the entire resource with only the policyName field changed in to devices.patch.
Using updateMask is preferable because it does an atomic read-modify-write.
As Fred mentioned, updateMask is the preferred way to go. Here's an example of how to use the updateMask approach in the Google colab
swap_result = androidmanagement.enterprises().devices().patch(
name='enterprises/ENTERPRISE_NAME/devices/DEVICE_ID', updateMask='policyName', body={ "policyName": "enterprises/ENTERPRISE_NAME/policies/NEW_POLICY_NAME"}).execute()
i foudn a solution for my problem:
{ "policyName": "policy2" , "state":"active"}
If you try this from management api test site then add updateMask as "policyName"
I'm trying to create Parse apps on the fly and use the keys while building my Android application. The API works great except for one point, it does not return the Client Key.
{
"appName": "my new app",
"dashboardURL": "https://www.parse.com/apps/my-new-app--30",
"applicationId": "oQqMyipkIgxYFXRROYTZsREfTcXp770awB1yMVrs",
"javascriptKey": "XAPZ7DoZHQIhMC8vPqN1m79wRIQyIXv7tmVIHmRs",
"windowsKey": "ZsyfFr0WtaQx6tsCokNSmTvjd05QCbCbMLzpChvP",
"webhookKey": "LyXnWJ3tRH56gK19KC1fjTvoUbdSUZoXhyO6khoT",
"restKey": "dzpdzYNkts2xZxPDVe7qC298Z20oIXhLJAPuY2Dw",
"masterKey": "0M2uUDZdKa1KYC1VBrmDaGK3chBaUMw0c2M4XXw1",
"clientPushEnabled": true,
"clientClassCreationEnabled": true,
"requireRevocableSessions": true,
"revokeSessionOnPasswordChange": true
}
And I need the client key as mentioned in the Android API:
Parse.initialize(this, "YOUR_APP_ID", "YOUR_CLIENT_KEY");
I have tried toggling the flags in vain.
What should I do inorder to access the Client Key?
Edit:
I'm talking about the Client Key which appears here: http://postimg.org/image/f76lj6xcr/
This was a minor bug in the Parse REST API. They fixed it within 48 hours after reporting.
I spent the last 5 hours trying to get large picture from Facebook page using this request:
https://graph.facebook.com/v2.1/Y.Anti.coup.D?fields=name,picture?type=large&access_token=CAAHH9uJXXOcBA
But I always get this error:
{ "error": {
"message": "Syntax error \"Expected end of string instead of \"?\".\" at character 12: name,picture?type=large",
"type": "OAuthException",
"code": 2500 } }
Sorry for my bad English, and I hope that you understand my problem.
You can do this a lot easier:
https://graph.facebook.com/page-id/picture?type=large
(no Access Token needed btw)
In your case, the problem is that you are using the question mark two times. This is how your code should work:
https://graph.facebook.com/v2.1/Y.Anti.coup.D?fields=name,picture&type=large&access_token=CAAHH9uJXXOcBA
Even by using sample project provided in Corona SDk , I get a notification with error 400. I guess my json data is correct. Following is the code for Json message.
local jsonMessage =
[[
"registration_ids": ["]] .. tostring(googleRegistrationId) .. [["],
"data":
{
"alert": "Hello World!",
"sound": "default"
}
}
]]
This is the message on my device.
Based on the 400 error code, the problem must be your JSON :
400
Only applies for JSON requests. Indicates that the request could not
be parsed as JSON, or it contained invalid fields (for instance,
passing a string where a number was expected). The exact failure
reason is described in the response and the problem should be
addressed before the request can be retried.
With all the square brackets and html tag, it's really hard to understand from your question how your JSON actually looks like.
Anyway, here's how it should look like :
{
"registration_ids": ["some reg id"],
"data":
{
"alert": "Hello World!",
"sound": "default"
}
}
I solved this error by changing the format of my json and checking the format on this link http://jsonlint.com/# . This was a great help and also I replace alert icon by custom icon by using this:
http://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html
seriously going insane here....
I'm trying to get the phonegap facebook plugin for android to work, but it's really driving me up the wall (no pun intented).
I am using the code from https://github.com/irnc/phonegap-plugin-facebook-connect/tree/oauth-2.0+irnc, at least I think I am.
I appear to have two problems:
the following callback in the login (from pg-plugin-fb-connect) gives an error because "FB.Auth.setAuthResponse(response.authResponse, response.status);" cannot be found. Am I using an incorrect facebook sdk? Apparently no, see edit below
PhoneGap.exec(function (response) {
console.log('PG.FB.login.success: ' + JSON.stringify(response) + ', store into localStorage ...');
localStorage.setItem(key, JSON.stringify(response));
FB.Auth.setAuthResponse(response.authResponse, response.status);
if (cb) {
cb(response);
}
}, null, service, 'login', ['publish_stream', 'read_stream']);
},
When I comment the FB.Auth.setAuthResponse(response.authResponse, response.status); statement, my login returns successfull! I get an authresponse with an accesstoken and status set to connected. When I try to execute the following code (on success callback)
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
console.log(JSON.stringify(response.error, null, 4));
alert('We are very sorry, but somthing went wrong');
} else {
alert('Message was successfully posted to your wall!');
}
});
it gives me an oauthexception message: "An active access token must be used to query information about the current user."
I authenticated with 'read_stream, publish_stream' permissions.
These two are probably related, but I can't find anything about the setAuthReponse call in the facebook api.
EDIT help is apparently not on it's way, but i've continued my quest to get this to work.
The facebook js sdk I got from the github repo's are all using the 'old' auth methods. I've downloaded the new facebook js sdk and FB.Auth.setAuthResponse is there. I copied the code to my existing js sdk and changed all calls to setSession to setAuthRepsonse. Everything is working fine, except that the access token doesn't appear to be posted when I make above FB.api calls. After these changes, the error remains exactly the same!
Oh yeah, I also changed the check in the login callback to check for authResponse instead of session (it's in the example).
Help is more than welcome,
rinze
I think I fixed this. Basically the ConnectPlugin.java is still returning a "session" response object instead of the "authResponse" that the new SDK expects.
See https://github.com/odbol/phonegap-plugin-facebook-connect/commit/0ef84e29603338930ff82fc6d6ef8525b668077d for details.