POST request with webmethods - rest

i am using webmethods platform 10.1 and i developed a service that is supposed to receive data as Post request.
when i try to run it on IDE it works fine, but when i publish it and try to access it through API Portal, it does not work.
i am not sure how to map my JSON to my Document. Can anyone please guide me in this regard?
I have attached my Document screen shot as well as the json i am trying to Post.
Can anyone explain how both are not related, because when i post the below JSON to my service, i do not get the values.
{
"EventCompanyId": "443",
"PositionTitleEn": "New post",
"PositionTitleAr": "New post",
"ReportsTo": "Manager",
"KnowledgeRequiredEn": "Basic knowlege",
"KnowledgeRequiredAr": "Basic knowledge",
"ExperienceRequired": "7 years",
"Gender": "1",
"EducationLevel": "4",
"CreatedBy": "1",
"UpdatedBy": "1",
"StartSalary": "35000",
"EndSalary": "35000",
"Status": "0",
"Certificate": "BS",
"YearsOfExperience": "7",
"Major": "5",
"Age": "30",
"JobType": "1",
"TrainingCourse": "",
"Weekdays": "",
"WorkingHours": "",
"Language": "1",
"Shift": "",
"JobLocations": [
{
"EmiratesId": 3,
"NumberOfVacancies": 3,
"EmiratesArea": "United Arab Emirates",
"Latitude": ,
"Longitude": ,
"EmirateEn": null,
"EmirateAr": null,
"EmirateName": null
},
{
"EmiratesId": 6,
"NumberOfVacancies": 23,
"EmiratesArea": " Dubai - United Arab Emirates",
"Latitude": 25.20447520001559,
"Longitude": 55.28122901916504,
"EmirateEn": null,
"EmirateAr": null,
"EmirateName": null
},
{
"EmiratesId": 1,
"NumberOfVacancies": 5,
"EmiratesArea": "Dubai - United Arab Emirates",
"Latitude": ,
"Longitude": ,
"EmirateEn": null,
"EmirateAr": null,
"EmirateName": null
},
{
"EmiratesId": 2,
"NumberOfVacancies": 3,
"EmiratesArea": "D72 - Dubai - United Arab Emirates",
"Latitude": ,
"Longitude": ,
"EmirateEn": null,
"EmirateAr": null,
"EmirateName": null
}
]
}

i have found a solution for it, the problem was i needed to remove Job Properties from under Job Document, they should not be inside any other property.

Related

Shopify REST API: Unable to add a new product variant with new option type getting error "Option values provided for 1 unknown option(s)"

when creating a product in Shopify via the REST API, adds a default option and variant like below
"options": [
{
"id": 9651869188247,
"product_id": 7644173172887,
"name": "Title",
"position": 1,
"values": [
"Default Title"
]
}
]
Variants:
{
"variants": [
{
"id": 42211487744151,
"product_id": 7644173172887,
"title": "Default Title",
"price": "1.00",
"sku": "",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2022-06-17T17:18:24+05:30",
"updated_at": "2022-06-17T17:18:24+05:30",
"taxable": true,
"barcode": null,
"grams": 0,
"image_id": null,
"weight": 0.0,
"weight_unit": "kg",
"inventory_item_id": 44310083534999,
"inventory_quantity": 0,
"old_inventory_quantity": 0,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/42211487744151"
}
]
}
I want to update the existing Option and Variants of a product to show "Color" & "Size" as options and variants of them. For that I tried the Shopify Rest API but that still is raising the below error
request model:
{
"variant": {
"product_id": 7644173172887,
"option1": "red",
"option2": "small",
"price": "1.0",
"title": "S"
}
}
response :
{
"errors": {
"base": [
"Option values provided for 1 unknown option(s)"
]
}
}
You are not specifing what endpoint you're using but I can see that you're specifing the Product Id and that should not be the case. If you need to add a new variant this is the request you should do
POST https://yourstore.myshopify.com/admin/api/2022-04/products/7644173172887/variants.json
{"variant":{"option1":"Red", "option2" :"Small", "title": "Red", "price":"1.00"}}
You will also need to update the current "Default Title" variant (I suggest, if possible to create the product with a valid variant).
PUT https://yourstore.myshopify.com/admin/api/2022-04/variants/42211487744151.json
{"variant":{"id":42211487744151,"option1":"Red","option2" : "S", "price":"99.00", "title" : "Red"}}

Factory Unhandled Exception: type '(dynamic) => DataAd' is not a subtype of type '(String, dynamic)

I have trying to figure out in some question but there is no case like me. I am getting the code from tutorial and I have understand it. However, the problem is in the tutorial. It uses static JSON (list) where mine using dynamic which contain keys.
Here is my code
class CompileAd {
String status;
String notification;
Map<int,DataAd> adData;
CompileAd({
required this.status,
required this.notification,
required this.adData,
});
factory CompileAd.fromJson(Map<String, dynamic> json) => CompileAd(
status: json["status"],
notification: json["notification"],
adData: Map<int,DataAd>.from(
json["adData"].map((x) => DataAd.fromJson(x))), => ERROR HERE
);
Map<String, dynamic> toJson() => {
"status": status,
"notification": notification,
"adData": Map<dynamic,dynamic>.from(adData.map((key,x) => x.toJson())), => HERE ALSO (Actually, I wish to use "jsonEncode(adData)" since its working but no idea which one better)
};
}
Error Log
lib/class/adClass.dart:27:69: Error: A value of type 'Map<String,
dynamic>' can't be returned from a function with return type
'MapEntry<dynamic, dynamic>'.
'Map' is from 'dart:core'.
'MapEntry' is from 'dart:core'.
"adData": Map<dynamic,dynamic>.from(adData.map((key,x) => x.toJson())),
^
Here is the json object
adData => (keyID,adObject)
{
"adData": {
"77289": {
"id": 77289,
"username": "magdatjahja#gmail.com",
"category": "rumah",
"subCategory": "rumah",
"type": "dijual",
"uniqueId": "6436",
"title": "Jual Rumah di Mazenta Bintaro Tangerang Selatan",
"slug": "jual-rumah-di-mazenta-bintaro-tangerang-selatan",
"content": "Jual rumah di mazento bintaro tangerang selatan\r\n\r\nSatu-satunya hunian premium di kawasan Bintaro bernuansa Japan Ambiance Living :\r\n\r\nType unit :\r\n\ud83d\udc49 Type 6 \r\nLuas Tanah: 72m2 \r\nLuas Bangunan: 83m2 \r\nKamar Tidur: 3 \r\nKamar Mandi: 2 \r\n\r\n\ud83c\udf81Dapatkan Promo Early Bird Price !!!\ud83c\udf81\r\n\u2705HARGA MULAI RP.1,8 M\r\n\u27053 unit AC 1 Pk\r\n\u2705Free Mini Canopy\r\n\u2705 Lucky Bowl up to Iphone13\r\n\u2705 SmartDoorlock\r\n\r\nLokasi\r\n\ud83d\ude97 Hanya 3 menit ke BXchange Mall Bintaro!\r\n\ud83d\ude97 Hanya 2-3 menit ke pintu tol! dan jumlah unit SANGAT terbatas!\r\n\ud83d\ude97Hanya 3 Menit Statiun Jurang Mangu\r\n\ud83d\ude97Hanya 3 menit UPJ University\r\n\r\n\r\nHubungi AGENT MERKETING\r\nMagda 08118897878",
"bid": 2000,
"balance": 1,
"price": "1800000000",
"province": "banten",
"regency": "tangerang selatan",
"district": "",
"village": "",
"complex": "",
"rd": 1,
"premier": "2022-03-22 11:33:13",
"partner": 1,
"privateSync": "0000-00-00 00:00:00",
"penaltyTime": null,
"data": {
"price": {
"price": "1800000000"
},
"priceUnit": "",
"province": "banten",
"regency": "tangerang selatan",
"district": "",
"village": "",
"additional": {
"address": "Bintaro, Tangerang Selatan",
"complex": "",
"lt": "72",
"lb": "83",
"bedroom": "3",
"bathroom": "2",
"maidbedroom": "",
"maidbathroom": "",
"floor": "",
"garage": "",
"carports": "",
"electricity": "",
"orientation": "",
"interior": ""
},
"facebook": "2022-03-22 14:54:05",
"twitter": "0000-00-00 00:00:00",
"pinterest": "0000-00-00 00:00:00",
"tumblr": "0000-00-00 00:00:00",
"premier": "2022-03-22 11:33:13",
"partner": true,
"penaltyTime": "2022-03-22 11:32:01",
"instagram": "2022-03-22 14:47:14"
},
"images": {
"images": ["jual-rumah-di-mazenta-bintaro-tangerang-selatan-0XOV3B.jpg", "jual-rumah-di-mazenta-bintaro-tangerang-selatan-VS38QN.jpg", "jual-rumah-di-mazenta-bintaro-tangerang-selatan-14RHI3.jpg"],
"imagesAdditional": [],
"images360": []
},
"video": {
"1": "https:\/\/youtu.be\/CA6iNWEDa1E"
},
"sosmed": 0,
"view": 28,
"contact": 0,
"status": "active",
"checked": 1,
"sold": "0000-00-00 00:00:00",
"modify": "0000-00-00 00:00:00",
"waktu": "2022-03-21 17:40:03",
"dir": "\/uploads\/images\/2022\/03\/77289\/",
"url": "\/properti\/tangerang-selatan\/6436-jual-rumah-di-mazenta-bintaro-tangerang-selatan\/"
}
},
"status": "success",
"notification": "Berhasil memproses permintaan"
}
I really appreciate any answers. Thank you.

How get attributes by postcode and sort by open = true

I've got Android application when I got a result by postcode. I need to get a result by postcode and sort by open.
How I can GET URL in sails js
http://192.168.1.8:1337/restaurant?postcode=LE36Rl?sort=open
Doesn't working
[
{
"id": 1,
"name": "Five guys",
"category": "chineese",
"address": "11 Castle street, Leicester, LE1 5WN",
"postcode": "LE36RL",
"logo": "https://fastly.4sqi.net/img/general/128x128/87388367_WyFLstNZmvbSC7jEyYvd4UYsrleRfPm8fL1ar5Vp_ps.png",
"open": true
},
{
"id": 2,
"name": "Japan Master",
"category": "chineese",
"address": "11 Castle street, Leicester, LE1 5WN",
"postcode": "le36rl",
"logo": "https://www.brandcrowd.com/gallery/brands/pictures/picture14867764381797.png",
"open": true
},

Trying to figure out how tax lines work when creating Shopify order via API

I am posting the following to the Shopify API create order endpoint and receiving a response without tax lines that are filled. I haven't seen anything on the internet on this, other than that Shopify doesn't offer another endpoint for just taxes. So, I am trying to figure out if tax lines are supposed to be generated automatically in the order response when creating an order via the API or if I have to include the tax lines in the request in order for tax lines to be included, because I know when I create an order in the admin the tax lines are automatically calculated and included for me?:
{
"order": {
"email": "some#email.com",
"financial_status": "paid",
"fulfillment_status": null,
"send_receipt": true,
"send_fulfillment_receipt": true,
"note": "Created by somename",
"line_items": [
{
"variant_id": 21718275463,
"quantity": 1,
"price": 99,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717700871,
"quantity": 1,
"price": 1000,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717690055,
"quantity": 1,
"price": 555,
"requires_shipping": true,
"product_id": 6821668807
}
],
"processing_method": "offsite",
"shipping_address": {
"first_name": "Chris",
"address1": "10101 Musick Road",
"phone": "9999999999",
"city": "St. Louis",
"zip": "63123",
"province": "MO",
"country": "United States",
"last_name": "Becker",
"name": "Chris Becker",
"country_code": "US",
"province_code": "MO"
},
"source_name": "somename",
"taxes_included": false,
"shipping_lines": [
{
"title": "standard",
"price": 0.00,
"code": null,
"source": "brand owner on shopify",
"carrier_identifier": null,
"tax_lines": null
}
],
"tags": "some Order"
}
}
Here is a useful documentation about tax: https://help.shopify.com/api/reference/location
Tax are not automatically calculated from cart.js ajax api. They just give a clue whether tax is already included in the price or not. If not, then it can be added with the bill.

How do I get user's checked-in places' categories?

I want to get logged in user's Check-ins along with the category of the place he has checked-in.
I tried to fetch the user likes and their categories and this is what worked for me - "/me/likes?fields=category"
Following is the response returned:
{
"data": [{
"name": "11 East Street Cafe",
"category": "Restaurant/Cafe",
"id": "94871278677"
},{
"name": "ABC DEF",
"category": "Politician",
"id": "177526890164"
}],
"paging": {
"cursors": {
"before": "NDkyMzg4OTc3NTYyMjk3",
"after": "MTc3NTI2ODkwMTY0"
}
}
}
For check-ins, I tried "/me/feed?with=location&fields=place,story" and it returns the checked in places list. It returns me following:
{
"data": [{
"place": {
"id": "117586118328311",
"name": "Carraba's",
"location": {
"city": "Ellicott City",
"country": "United States",
"latitude": 39.27153726574,
"longitude": -76.800542073324,
"state": "MD",
"zip": "21043"
}
},
"story": "ABC was at Carraba's.",
"id": "1533836476934935_1546360939015822"
}, {
"place": {
"id": "876737405718973",
"name": "Chipotle Mexican Grill",
"location": {
"city": "Baltimore",
"country": "United States",
"latitude": 39.2866707,
"longitude": -76.6196671,
"state": "MD",
"street": "300 W Pratt St",
"zip": "21201"
}
},
"story": "Aadya Extentia was at Chipotle Mexican Grill.",
"id": "1533836476934935_1546360502349199"
}],
"paging": {
"next": "https://graph.facebook.com/v2.5/1533836476934935/feed?fields=place,story&wi…WzlgXDpe8ZCV8kHWcO2aNxlARSpwIZByS9OWkU8VC3nj2E3VoiLkJNpy2ESOI1R7fHIOJQZDZD"
}
}
But it does not return the category of checked-in place. i.e. I want know if it is a restaurant, museum or stadium, etc.
How do I do it?
Thanks.
You can do this using Field Expansion:
/me/feed?with=location&fields=place{name,category},story
Edit: Looks like this is working for API version <= 2.4 only, but not any more with v2.5.
Edit #2: I filed a bug report to ask if this was deliberately removed, or if it is a bug. https://developers.facebook.com/bugs/1550467468600884/
Even though a Place is a Page, I can't successfully retrieve the category field through Field Expansion...
This can be done with a batch request, by using the output of the first query as input for the second query:
curl \
-F 'access_token={USER_ACCESS_TOKEN}' \
-F 'include_headers=false' \
-F 'batch=[{ "method":"GET","name":"get-places","relative_url":"me/feed?with=location&fields=place{id,name,location},story&limit=100", "omit_response_on_success": false },{"method":"GET","relative_url":"?ids={result=get-places:$.data.*.place.id}&fields=id,name,category"}]' \
https://graph.facebook.com
See
https://developers.facebook.com/docs/graph-api/reference/place/
https://developers.facebook.com/docs/graph-api/making-multiple-requests/