What is the RegionsVersion property used with the Google Play Developer API? - google-api

I am trying to use the Google Play Developer API to patch a subscription using the REST endpoint.
https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions/patch
The required query parameters are updatedMask and regionsVersion. When I click on the RegionsVersion for documentation it just says:
A string representing version of the available regions being used for
the specified resource.
https://developers.google.com/android-publisher/api-ref/rest/v3/RegionsVersion
Based on that description I'm not sure what kind of value it's expecting other than an object with a version property that is a string. When I omit the regionsVersion parameter is returns the following error:
{
"error": {
"code": 400,
"message": "Regions version should be set to the default value 2022/01.",
"status": "INVALID_ARGUMENT"
}
}
Does anyone have any idea or an example of how this required parameter is intended to be used?

I had the same issue and I found that since it's s JSON object you'll have to set its property like that with query params:
?updateMask=listings&regionsVersion.version=2022/01
This worked fine for me!

Related

Strapi - Your filters contain a field '_publicationState' that doesn't appear on your model definition nor it's relations

I am learning to use Strapi (doing a course). I am doing a simple request to Strapi:
http://localhost:1337/products
However I am getting this cryptic answer which I have no way of understanding. It seems as if I need to specify somehow in the url some _publicationState filter?
I have created a simple content type called product which has 4 fields:
name (text)
description (text)
price (float)
image (media)
I have no other _publicationState field on my content type "product" nor did I do anything specific apart from creating this content type. I haven't created any specific API request/filter or anything that could produce such error. Can anyone that is familiar with STRAPI help? My guess is this is added by STRAPI by default and my URL request needs to be amended. Clearly the course is outdated as person that teaches this does not have any such issue, however I am somewhat stuck at this point. Thank you for your patience with me, I am learning.
{
"statusCode": 400,
"error": "Bad Request",
"message": "Your filters contain a field '_publicationState' that doesn't appear on your model definition nor it's relations"
}

What cx code must be used in the Programmable Search Engine JSON Api endpoint

According to the rest api documentation of the Programmable Search Engine documentation, the cx parameter must contain the Programmable Search Engine ID. The example uses 017576662512468239146:omuauf_lfve as example. When making our own search engine on https://cse.google.com/, it shows a hexadecimal search engine id, but when using that as the input for the cx parameter we get a bad request error. Using our API key with the example search engine code does work, which makes me believe that we are just entering something invalid into this field. I am unsure however where we are supposed to get the information for this field otherwise. What cx code must be used in the Programmable Search Engine JSON api endpoint?
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
This was likely an issue with Google's api itself not accepting the new format, as the documentation now mentions
Note: The Search Engine ID (cx) can be of different format (e.g. 8ac1ab64606d234f1)

GraphQL with status code is correct solution? [duplicate]

This question already has answers here:
GraphQL - How to respond with different status code?
(5 answers)
Closed 3 years ago.
Previous When I made API server with RestAPI, I return data with HTTP status code.
So, Frontend receive status code from server, it determined request is success of fail.
I know that graphQL has error fields, and can refer it to solve this issue.
But I want to change response status code that send to client.
This way is correct and stable way?
Or, When use graphQL, do not change status code and just determine by error field is standard way?
Any suggestions would be appreciated :)
Thanks.
[...] do not change status code and just determine by error field is standard way?
YES do not manage errors using status codes, they are Http related and GraphQL aim at being protocol/framework agnostic so that everything you need should be inside your output.
As you said there can be an errors field in your response:
The errors entry in the response is a non‐empty list of errors, where each error is a map.
If no errors were encountered during the requested operation, the errors entry should not be present in the result.
The spec states that errors field entries can have a field named extensions:
GraphQL services may provide an additional entry to errors with key extensions. This entry, if set, must have a map as its value. This entry is reserved for implementors to add additional information to errors however they see fit, and there are no additional restrictions on its contents.
Using the extensions field you can add custom machine-readable information to your errors like the key code here.
{
"errors": [
{
"message": "Name for character with ID 1002 could not be fetched.",
"locations": [ { "line": 6, "column": 7 } ],
"path": [ "hero", "heroFriends", 1, "name" ],
"extensions": {
"code": "CAN_NOT_FETCH_BY_ID",
"timestamp": "Fri Feb 9 14:33:09 UTC 2018"
}
}
]
}
Apollo Prophecy
To make error management easier I created a codegen CLI that generate throwable errors classes for the server and facilitate error handling for client.
https://github.com/theGlenn/apollo-prophecy

odata open type filter

Trying to use OData filter in WebApi 2.
But it seems it`s not working over open type (dynamic properties).
Receiving error :
Validating OData QueryNode of kind CollectionOpenPropertyAccess is not
supported by FilterQueryValidator.
Server return Array of objects that include Id and Properties , and in Properties i have property that contain array of string.. I want to make filter over this array.. I'm sure my request url is ok because it works with ordinary data. I think the problem is in open type .. I found this question is very similar : https://stackoverflow.com/questions/33427594/filter-by-datetime-with-odata-in-dictionary/33442032 , but doesn`t have answer ?
Using : Odata v4 and WebApi2
Example server result :
{
"Id": 1,
"Context#odata.type": "#Collection(String)",
"Context": [
"Context1", "Context2"
]
}
Example http request :
http://localhost/API/odata/GetItems(id=30045)?$count=true&$filter=Context%2Fany(c:+c+eq+%27Context1%27)&$format=json&$top=5
It's not supported by now, Open an issue to track
https://github.com/OData/WebApi/issues/770

Web API ignores non-model body parameters; should throw error

In Web API v2 when you supply data in the POST body that are not part of the model, they are ignored by the framework. This is fine in most cases, but I need to check this and return an error response, so the user doesn't get unexpected results (he expects these wrong parameters to do something...).
So how do I check for this? The model will be null, but when the framework has parsed the data and returned a null-model, I can no longer access the body through Request.Content. So what options are there?
One way is to derive your DTO class from DynamicObject. Check out my blog post: http://lbadri.wordpress.com/2014/01/28/detecting-extra-fields-in-asp-net-web-api-request/

Resources