I'm getting the following error when using the Google API Explorer to insert into GCP's Datastore.
I've tried using another name and ID, but still the error. How do I rectify this?
Below are the request body and error.
{
"mode": "Transactional",
"mutations": [
{
"insert": {
"key": {
"path": [
{
"id": "56294995342131231",
"name": "CL-001",
"kind": "Log"
}
],
"partitionId": {
"namespaceId": "",
"projectId": "triplog-169706"
}
},
"properties": {
"Title": {
"stringValue": "Space Needle"
},
"Longitude": {
"doubleValue": 0.00
},
"Latitude": {
"doubleValue": 0.00
},
"Date": {
"timestampValue": "2015-07-03T10:51:50.649Z"
},
"Rating": {
"integerValue": "5"
},
"Notes": {
"stringValue": "Wonderful site to see"
}
}
}
}
]
}
{
"error": {
"code": 400,
"message": "Invalid value at 'mutations[0].insert.key.path[0]' (oneof), oneof field 'id_type' is already set. Cannot set 'name'",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "mutations[0].insert.key.path[0]",
"description": "Invalid value at 'mutations[0].insert.key.path[0]' (oneof), oneof field 'id_type' is already set. Cannot set 'name'"
}
]
}
]
}
}
Based on the docs, it looks like you should only be setting either a "name" or "id" in the Path Element, not both.
https://cloud.google.com/datastore/docs/reference/rest/v1/Key#PathElement
I've finally got it.
To get the "transaction", just run the beginTransaction API.
POST https://datastore.googleapis.com/v1/projects/{projectId}:beginTransaction
This will response with an identifier, which is a long string. Use that as the value of the "transaction".
Related
I don't know how to configure the inventory detail in the JSON
I'm trying to POST at https://<>.suitetalk.api.netsuite.com/services/rest/record/v1/inventoryAdjustment
this JSON
{
"account": 4738,
"trandate":"2022-11-14",
"subsidiary":3,
"inventory":
{
"items":
[
{
"item": 9908,
"location":25,
"adjustQtyBy": 100,
"memo":"m-203174 p-21992 c-TM/55 #2"
,
"inventoryDetail":
{
"inventoryAssignment":
[
{
"receiptInventoryNumber": 2002111,
"quantity": 100
}
]
}
}
]
}
}
but i'm receiving this error:
{
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": 400,
"o:errorDetails": [
{
"detail": "Error while accessing a resource. You still need to reconfigure the inventory detail record after changing the quantity.",
"o:errorPath": "inventory.items[0]",
"o:errorCode": "USER_ERROR"
}
]
}
i got this second error after changing inventorydetail section:
{
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": 400,
"o:errorDetails": [
{
"detail": "Invalid content in the request body.",
"o:errorCode": "INVALID_CONTENT"
}
]
}
Now it works
{
"account": 4737,
"trandate":"2022-11-14",
"subsidiary":3,
"inventory":
{
"items":
[
{
"item": 9908,
"location":25,
"adjustQtyBy": 100,
"memo":"P$203174$21992$TM/55$2"
,
"inventoryDetail":
{
"inventoryAssignment":
{
"items":
[
{
"receiptInventoryNumber": 2002111,
"quantity": 100,
"expirationDate":"2022-11-30"
}
]
}
}
}
]
}
}
I have problem with webhook, or to be more accurate - with sending data with POST method using endpoint.
I am using this endpoint for POST method:
https://edapi.campaigner.com/v1/Import/AddOrUpdate?ApiKey=apikey_value
and this JSON snippet:
{
"Subscribers": [
{
"EmailAddress": "email",
"CustomFields": [
{
"FieldName": "Source",
"Value": "source"
},
{
"FieldName": "Campaign",
"Value": "campaign"
},
{
"FieldName": "Medium",
"Value": "medium"
}
],
"Lists": [
200468800
]
}
]
}
But, after I set automation workflow to trigger transfer data from one database (provider 1) to another base (provider 2) I get error:
{
"ContactsSubmitted": 1,
"Successes": 0,
"Failures": [
{
"EmailAddress": "email",
"ErrorCode": 101,
"Message": "Invalid Email Address"
}
]
}
Any suggestions? Additional explanation: FieldName is name from provider 2 and field value is name from provider 1.
Missing [some_variable ] is part where my code throws and error. So, the right code is:
{
"Subscribers": [
{
"EmailAddress": "[email]",
"CustomFields": [
{
"FieldName": "Source",
"Value": "[source]"
},
{
"FieldName": "Campaign",
"Value": "[campaign]"
},
{
"FieldName": "Medium",
"Value": "[medium]"
}
],
"Lists": [
200468800
]
}
]
}
I have a JSON API endpoint for retrieving the user. This resource will also be used to get the permissions of the user, for showing or hiding specific elements in our front end application.
The resource looks like this:
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"jsonapi": {
"version": "1.0"
},
"meta": {
"content-type": "application/vnd.api+json"
},
"links": {
"self": "/users/some-uuid"
},
"data": {
"type": "users",
"id": "some-uuid",
"attributes": {
"email": "some-email#example.com",
"permissions": [
"view-all-users",
"view-all-shifts"
]
},
"relationships": {
"roles": {
"data": [
{
"type": "role",
"id": "some-role-uuid"
}
]
}
}
}
}
The permissions attribute holds the slugs for the permissions that the user has.
If this attribute was not present the front end application would have to include the resources roles and roles.permissions to be able to get to the user's permissions. That response would look like the following:
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"jsonapi": {
"version": "1.0"
},
"meta": {
"content-type": "application/vnd.api+json"
},
"links": {
"self": "/users/some-uuid"
},
"data": {
"type": "users",
"id": "some-uuid",
"attributes": {
"email": "some-email#example.com",
"permissions": [
"view-all-posts",
"edit-all-posts"
]
},
"relationships": {
"roles": {
"data": [
{
"type": "role",
"id": "some-role-uuid"
}
]
}
},
"included": [
{
"type": "roles",
"id": "some-role-uuid",
"attributes": {
"name": "Editor"
},
"relationships": {
"permissions": {
"data": [
{
"type": "permission",
"id": "some-permission-uuid"
},
{
"type": "permission",
"id": "some-permission-uuid-2"
}
]
}
}
},
{
"type": "permissions",
"id": "some-permission-uuid",
"attributes": {
"slug": "view-all-posts"
}
},
{
"type": "permissions",
"id": "some-permission-uuid",
"attributes": {
"slug": "edit-all-posts"
}
}
]
}
}
In this case the front end has to do a lot of processing just to get to the permission slugs. My question here is: Is it bad to have a short hand attribute permissions on the user resource like the above example, or should the front end always get to the slugs through the relationships?
Note: In the future we will have an admin interface where the user can manage users, roles and permissions. That is why the roles and permissions are available as seperate entities.
Client apps can easily merge all the permissions from roles into one key/array themselves and work from there. This way you'll keep the principles of JSON API in tact and give the client apps the freedom to work with permissions as they prefer.
im working with zapier.com to make a conection between firestore collection to google docs, there is a part to make a StructuredQuery where im getting the 400 error, because he seems not to find the field
I have tried to change the syntax many times, but it seems not to work
the JSON part:
{
"orderBy": [{
"id": {
"fieldPath": "title"
},
"direction": "DESCENDING"
}]
}
it sends me this:
We had trouble finding a sample.
Error code 400: [{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"id\" at 'structured_query.order_by[0]': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "structured_query.order_by[0]",
"description": "Invalid JSON payload received. Unknown name \"id\" at 'structured_query.order_by[0]': Cannot find field."
}
]
}
]
}
}
]
the firebase part that i try to reach
the solution for anyone that found this helpfull
{
"orderBy": [{
"field": {
"fieldPath": "id"
},
"direction": "DESCENDING"
}]
}
Try this
{
"orderBy": [
{
"field": {
"fieldPath": "name" //name is the field in you document.
},
"direction": "DESCENDING"
}
]
}
In version 1.7.0 of Orion CB running the docker version in Docker for Windows,
if I create a simple object doing POST http://localhost:1026/v1/updateContext
with the body:
{
"contextElements": [
{
"type": "Car",
"id": "myNewCar",
"attributes": [
{
"name": "maxSpeed",
"type": "integer",
"value": "220"
}
]
}
],
"updateAction": "APPEND"
}
I get the answer:
{
"contextResponses": [
{
"contextElement": {
"type": "Car",
"isPattern": "false",
"id": "myNewCar",
"attributes": [
{
"name": "maxSpeed",
"type": "integer",
"value": ""
}
]
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
Then, if I do POST http://localhost:1026/v1/queryContext with the same headers and the same components with the body
{
"entities": [
{
"type": "Car",
"isPattern": "false",
"id": "myNewCar"
}
]
}
I get the following:
{
"errorCode": {
"code": "404",
"reasonPhrase": "No context element found"
}
}
Which shouldn't be problematic (I can query the entities with v2 API, for instance) if it wasn't needed for integration with data representation tools such as SpagoBI as documented in http://spagobi.readthedocs.io/en/latest/user/NGSI/README/
What can I do? I am doing something wrong with the context provision?
Thanks!
My problem was that I was using a imported Postman collection of the API (Downloaded from https://github.com/telefonicaid/fiware-orion/tree/develop/doc/apiary/v2) and accidentally I was using the header Fiware-Service.
You are right and your tests work properly.
Thanks for the prompt reply!!