On inserting province/state on orders using Shopify API - shopify

I can't seem to insert the state name or code on API orders in Shopify.
When I use this to create an order using API.
"shipping_address" : {
"first_name" : "Ajo",
"last_name" : "Fod",
"address1" : "90 selwyn rd",
"address2" : "",
"city" : "Braintree ",
"province" : "Ma",
"zip" : "02184",
"country" : "Usa",
"province_code" : "MA"
},
I get this in the order dashboard on Shopify:
Why is the state code missing?
How do I get the state code back in there?

The countries and provinces are validated. Instead of Usa try using US or another ISO 3166-1 alpha-2 country code.

Related

How do I query an array in MongoDB?

I have been trying multiple queries but still can't figure it out. I have multiple documents that look like this:
{
"_id" : ObjectId("5b51f519a33e7f54161a0efb"),
"assigneesEmail" : [
"felipe#gmail.com"
],
"organizationId" : "5b4e0de37accb41f3ac33c00",
"organizationName" : "PaidUp Volleyball Club",
"type" : "athlete",
"firstName" : "Mylo",
"lastName" : "Fernandes",
"description" : "",
"status" : "active",
"createOn" : ISODate("2018-07-20T14:43:37.610Z"),
"updateOn" : ISODate("2018-07-20T14:43:37.610Z"),
"__v" : 0
}
I need help writing a query where I can find this document by looking up the email in any part of the array element assigneeEmail. Any suggestions? I have tried $elemMatch but still could not get it to work.
Looks like my query was just incorrect. I figured it out.

Example of presenceGroup used in apiRTC.init

In the documentation it is indicated that presenceGroup and subscribeToPresenceGroup can be set in the apiRTCinit. They are json parameters, but what exactly is the format? What do they each do, they sound redundant, so I am not clear.
Here is a sample of apiRTC.init() :
//apiRTC init
apiRTC.init({
apiKey : "myDemoApiKey",
//apiCCId : "229",
onReady : sessionReadyHandler,
userData : {
"lastName": "lastName",
"firstName": "firstName"
},
presenceGroup : ["agent"],
subscribeToPresenceGroup : ["visitor", "agent"]
});
presenceGroup : define the groups of the user : user will be considered as present in these groups
subscribeToPresenceGroup : define the presence group to which the user has subscribed : user will receive the presence information for these groups.
In our sample : user is connected to group "agent", but will receive presence information for group "visitor" and group "agent"

Asana task field "hearts" user ids

Asana task field hearts contains user ids that are not equal to the workspace's user ids. Is that a bug or a feature?
According to the api documentation:
hearts
[ { id: 1123, name: 'Mittens' }, ... ]
Read-only. Array of users who have hearted this task.
Note: a Heart is an object in its own right, with its own ID. If you want the ID of the User who "created" the heart, you need to use hearts.user.id, which is the same as the ID of the user in the workspace (i.e. you could do GET /users/:id).
Example using ?opt_expand=hearts:
"hearts" : [
{
"target" : {
"name" : "Task name here",
"id" : 1234 // ID OF TASK
},
"id" : 1235, // ID OF HEART
"user" : {
"name" : "User name",
"id" : 1236 // ID OF USER
},
"created_at" : "2015-11-30T12:40:13.516Z"
}
],

Field being ignored when querying

I have the following document
{
"authors" : "Nanna Friis",
"authorsId" : [ "4642" ],
"description" : "Med denne praktiske og pædagogiske håndbog kommer du hele vejen rundt om at skrive godt til nettet. Du bliver taget ved hånden og får en grundig gennemgang af de helt særlige præmisser, der hersker på nettet. ",
"iSBN" : "9788762904118",
"mediaType" : "10",
"name" : "Kort, klart og klikbart",
"nameSort" : "Kort, klart og klikbart",
"price" : 250.0,
"productId" : "9788762904118",
"publicationAreaCode" : "3077",
"tags" : [ ],
"titleId" : "25004"
}
When doing a query like this http://localhost:9200/titles/_search?q=Nanna* i don't get any results. If i instead query on ie. the productId like this http://localhost:9200/titles/_search?q=9788762904118 im getting the document in question.
What is going on?
you do not specify the query field in the request
in such case you will search the Default Search Field
When not explicitly specifying the field to search on in
the query string syntax, the index.query.default_field will be used to
derive which field to search on. It defaults to _all field.
So, if _all field is disabled, it might make sense to change it to set
a different default field.

MultiLevel JSON in PIG

I am new to PIG scripting and working with JSONs. I am in the need of parsing multi-level json files in PIG. Say,
{
"firstName": "John",
"lastName" : "Smith",
"age" : 25,
"address" :
{
"streetAddress": "21 2nd Street",
"city" : "New York",
"state" : "NY",
"postalCode" : "10021"
},
"phoneNumber":
[
{
"type" : "home",
"number": "212 555-1234"
},
{
"type" : "fax",
"number": "646 555-4567"
}
]
}
I am able to parse a single level json through JsonLoader() and do join and other operations and get the desired results as JsonLoader('name:chararray,field1:int .....');
Is it possible to parse the above mentioned JSON file using the built-in JsonLoader() function of PIG 0.10.0. If it is. Please explain me how it is done and accessing fields of the particular JSON?
You can handle nested json loading with Twitter's Elephant Bird: https://github.com/kevinweil/elephant-bird
a = LOAD 'file3.json' USING com.twitter.elephantbird.pig.load.JsonLoader('-nestedLoad')
This will parse the JSON into a map http://pig.apache.org/docs/r0.11.1/basic.html#map-schema the JSONArray gets parsed into a DataBag of maps.
It is possible by creating your own UDF. A simple UDF example is shown in below link
http://pig.apache.org/docs/r0.9.1/udf.html#udf-java
C = load 'path' using JsonLoader('firstName:chararray,lastName:chararray,age:int,address:(streetAddress:chararray,city:chararray,state:chararray,postalCode:chararray),
phoneNumber:{(type:chararray,number:chararray)}')