Podio Api: Why does PUT request /app/{app_id}/field/{field_id} delete category field options for contact apps? - api

I'm tring to modify category fields of a contact app using Podio API.
I get the following response for the GET request (https://api.podio.com/app/22768616/field/189304190):
(Previously I created the field with a POST request and everything works fine)
{
"status": "active",
"type": "category",
"field_id": 189304190,
"label": "myCategories",
"config": {
"default_value": null,
"unique": false,
"description": null,
"hidden_create_view_edit": false,
"required": false,
"mapping": null,
"label": "myCategories",
"visible": true,
"delta": 9,
"hidden": false,
"settings": {
"multiple": false,
"options": [
{
"status": "active",
"text": "Cat1",
"id": 1,
"color": "DCEBD8"
},
{
"status": "active",
"text": "Cat2",
"id": 2,
"color": "DCEBD8"
},
{
"status": "active",
"text": "Cat3",
"id": 3,
"color": "DCEBD8"
},
{
"status": "active",
"text": "Cat4",
"id": 4,
"color": "DCEBD8"
}
],
"display": "dropdown"
}
},
"external_id": "mycategories-2"
}
If I send a PUT request to https://api.podio.com/app/22768616/field/189304190 with the same response, the dropdown category field changes to an inline category field and all the options are deleted. (I expected nothing would happen to my field, I also tried to modify the text of the options, but got the same result).
{
"status": "active",
"type": "category",
"field_id": 189304190,
"label": "myCategories",
"config": {
"default_value": null,
"unique": false,
"description": null,
"hidden_create_view_edit": false,
"required": false,
"mapping": null,
"label": "myCategories",
"visible": true,
"delta": 0,
"hidden": false,
"settings": {
"multiple": false,
"options": [
{
"status": "deleted",
"text": "Cat1",
"id": 1,
"color": "DCEBD8"
},
{
"status": "deleted",
"text": "Cat2",
"id": 2,
"color": "DCEBD8"
},
{
"status": "deleted",
"text": "Cat3",
"id": 3,
"color": "DCEBD8"
},
{
"status": "deleted",
"text": "Cat4",
"id": 4,
"color": "DCEBD8"
}
],
"display": "inline"
}
},
"external_id": "mycategories-2"
}
Could you please help with any example to update a category fields correctly?

Can you add what the body is when you are using the PUT endpoint?
My guess is that you are somehow not mapping the "settings" parameter correctly. Per the API documentation the settings parameter for a category field should follow this format:
{
"options": The list of options for the question
[
{
"id": The id of the option, only use this for existing options,
"status": The current status of the option, "active" or "deleted", only use this to delete options,
"text": The text for the option (required)
},
... (more options)
],
"multiple": True if multiple answers should be allowed, False otherwise
}

Related

How to create a new database on Notion API with the new "Status" property?

Notion API HTTP requests are not working when I add a new "Status" propoerty for a new database creation.
I've been trying for a while to figure out why, sending Notion a simple HTTP POST request with a "Status" breaks it.
If I just replace "Status" with a simple "Select" it works fine...
This is the code that I tried on my latest attempt:
{
"is_inline": true,
"parent": {
"type": "page_id",
"page_id": page_id
},
"icon": {
"type": "emoji",
"emoji": "🐟"
},
"title": [
{
"type": "text",
"text": {
"content": "Catches",
"link": null
}
}
],
"properties": {
"Name": {
"title": {}
},
"Status": {
"status": {
"options": [
{
"name": "Not started",
"color": "default"
},
{
"name": "25% Complete",
"color": "blue"
},
{
"name": "50% Complete",
"color": "blue"
},
{
"name": "75% Complete",
"color": "blue"
},
{
"name": "Done",
"color": "green"
},
{
"name": "Blocked",
"color": "red"
}
]
}
}
}
}
Status ref page on Notions docs: https://developers.notion.com/reference/property-object#status-configuration

When using the Quickbooks API explorer, read a vendor endpoint returns additional fields. How do I get these fields in actual API results?

Response from API via API explorer(by Intuit)
{
"Vendor": {
"BillAddr": {
"Id": "9",
"Line1": "31/2-34/2B, G01, Ground Floor (P V Enclave, V-Step Road)",
"Line2": "Kempapura",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "karnataka",
"PostalCode": "560037"
},
"BusinessNumber": "ABPFA3772K",
"Balance": 12960,
"BillRate": 0,
"Vendor1099": false,
"CurrencyRef": {
"value": "INR",
"name": "Indian Rupee"
},
"TDSEnabled": true,
"TDSEntityTypeId": 2,
"TDSSectionTypeId": 20,
"TDSOverrideThreshold": false,
"GSTIN": "29ABPFA3772K1ZT",
"GSTRegistrationType": "GST_REG_REG",
"CostRate": 0,
"domain": "QBO",
"sparse": false,
"Id": "5",
"SyncToken": "3",
"MetaData": {
"CreateTime": "2021-11-29T04:13:02-08:00",
"LastUpdatedTime": "2022-06-19T11:18:01-07:00"
},
"CompanyName": "Asyncauto",
"DisplayName": "Asyncauto",
"PrintOnCheckName": "Asyncauto",
"Active": true,
"V4IDPseudonym": "002085e0c7fca007484293913d58943f84b215",
"PrimaryPhone": {
"FreeFormNumber": "1231231234"
},
"PrimaryEmailAddr": {
"Address": "123123#mralbert.in"
}
},
"time": "2022-06-19T19:00:23.349-07:00"
}
Response from the actual API endpoint (quickbooks.api.intuit.com)
{
"Vendor": {
"BillAddr": {
"Id": "9",
"Line1": "31/2-34/2B, G01, Ground Floor (P V Enclave, V-Step Road)",
"Line2": "Kempapura",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "karnataka",
"PostalCode": "560037"
},
"BusinessNumber": "ABPFA3772K",
"Balance": 12960.00,
"Vendor1099": false,
"CurrencyRef": {
"value": "INR",
"name": "Indian Rupee"
},
"domain": "QBO",
"sparse": false,
"Id": "5",
"SyncToken": "3",
"MetaData": {
"CreateTime": "2021-11-29T04:13:02-08:00",
"LastUpdatedTime": "2022-06-19T11:18:01-07:00"
},
"CompanyName": "Asyncauto",
"DisplayName": "Asyncauto",
"PrintOnCheckName": "Asyncauto",
"Active": true,
"PrimaryPhone": {
"FreeFormNumber": "1231231234"
},
"PrimaryEmailAddr": {
"Address": "123123#mralbert.in"
}
},
"time": "2022-06-19T19:04:59.703-07:00"
}
Notice that in the second case these fields - "TDSEnabled","TDSEntityTypeId","TDSSectionTypeId","TDSOverrideThreshold","GSTIN","GSTRegistrationType", are missing.
How do I get these fields in the regular production endpoint?
Try using Postman and see if issue persist then you need to talk with quickbooks support.
I have found that in indian edition of quickbooks still has many issue open.

Square API: Object version does not match latest database version

I'm trying to use the following Square API endpoint to update an item, but I'm getting some errors. Here is the item that I'm trying to update.
{
"type": "ITEM",
"id": "7HXK6NVBDKSOK64CCAYZJ2KW",
"updated_at": "2020-08-08T21:43:41.849Z",
"version": 1596923021849,
"is_deleted": false,
"present_at_all_locations": false,
"present_at_location_ids": [
"1JZ5JTPBW0EXY"
],
"item_data": {
"name": "Hummus Plate",
"description": "Olives, feta, tomatoes, tzatziki and warm pita.",
"visibility": "PRIVATE",
"category_id": "ARB5LTTDUSER6T66ZWYO65FL",
"variations": [
{
"type": "ITEM_VARIATION",
"id": "HBIHPLROOJUUNUSW3BZUDQ5J",
"updated_at": "2020-08-08T21:40:14.581Z",
"version": 1596922814581,
"is_deleted": false,
"present_at_all_locations": false,
"present_at_location_ids": [
"1JZ5JTPBW0EXY"
],
"item_variation_data": {
"item_id": "7HXK6NVBDKSOK64CCAYZJ2KW",
"name": "Regular",
"ordinal": 0,
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": 1000,
"currency": "USD"
}
}
}
],
"product_type": "REGULAR",
"skip_modifier_screen": true,
"ecom_available": false,
"ecom_visibility": "UNINDEXED"
}
}
Here the body content.
{
"batches": [{
"objects": [{
"type": "ITEM_VARIATION",
"id": "T6KKCATDIU2VV4BDBMVGML4W",
"item_variation_data": {
"item_id": "FNWWGFTBQWFAYK6JGBD3LDLD",
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": 150,
"currency": "USD"
}
}
}]
}],
"idempotency_key": "61994762-3a6s-4b75-sf81-fdfaf"
}
Here is the error I'm getting:
**{
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "VERSION_MISMATCH",
"detail": "Object version does not match latest database version.",
"field": "version"
}
]
}**
I'm not sure what I'm doing wrong, but I appreciate any help I can get. Thank you in advance!
When updating a catalog object in Square, you need to provide the latest version number in the request.
{
"batches": [{
"objects": [{
"type": "ITEM_VARIATION",
"id": "T6KKCATDIU2VV4BDBMVGML4W",
"version": "12345",
"item_variation_data": {
"item_id": "FNWWGFTBQWFAYK6JGBD3LDLD",
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": 150,
"currency": "USD"
}
}
}]
}],
"idempotency_key": "61994762-3a6s-4b75-sf81-fdfaf"
}

Bot duplicates user messages when I use DirectLine channel

I am using bot framework v4. I have developed a chatbot using .Net Core. The bot is integrated with LUIS and Qna Maker. One issue I am facing is that the bot duplicates the message that comes from the user. Please look at the screenshot below:
The replies I get from the bot are perfectly fine. The flow of the bot is as intended. I just cannot figure out why the message from user is being duplicated. I am using DirectLine for this. I will share whatever code part is needed.
{
"activities": [
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000000",
"timestamp": "2019-12-02T19:41:57.1284328Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"size": "large",
"url": "https://i.imgur.com/ViaEUnA.png"
}
]
}
],
"horizontalAlignment": "Center"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "Welcome to CIVIC Financial Services",
"wrap": true
},
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "I am S.U.E",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "I can help you answer your questions. Familiarize yourself with CIVIC Financial Services.",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "If you want to talk to a Customer Service Agent, just type \"I want to talk to a Customer Service Agent\".",
"wrap": true
}
],
"separator": true,
"horizontalAlignment": "Left"
}
]
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"data": {
"action": "aboutCivic"
},
"title": "About CIVIC"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"actions": [
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "We are open from Monday through Friday from 8:00am to 6:00pm.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "When are you open?"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Image",
"size": "stretch",
"url": "https://i.imgur.com/gBVgI25.png",
"horizontalAlignment": "center"
},
{
"type": "TextBlock",
"text": "AZ, CA, CO, FL, GA, HI, NC, NV, OR, SC, TN, TX, UT, VA & WA",
"wrap": true
}
],
"style": "emphasis"
},
"title": "Do you have an office near me? "
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "8 to 10 days, it all depends on how it takes to get access to the property.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "How quickly can we close? "
}
],
"style": "emphasis"
},
"title": "FAQs"
}
]
}
}
],
"entities": [],
"replyToId": "8WGOnspSxN3"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000001",
"timestamp": "2019-12-02T19:43:39.96502Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"entities": [
{
"type": "ClientCapabilities",
"requiresBotState": true,
"supportsListening": true,
"supportsTts": true
}
],
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000002",
"timestamp": "2019-12-02T19:43:41.7278914Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000001"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000003",
"timestamp": "2019-12-02T20:00:25.784598Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "helo",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000004",
"timestamp": "2019-12-02T20:00:26.5739342Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000003"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000005",
"timestamp": "2019-12-02T20:00:27.3293896Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "hello",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000006",
"timestamp": "2019-12-02T20:00:27.6064185Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Hello",
"inputHint": "acceptingInput",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000005"
}
],
"watermark": "6"
}

Add Product Variant - 404 Error

I am developing a VB.NET application to interact with our new Shopify store. I am in the process of automating product additions/updates/removal based on data in our Oracle database.
Basically the application creates a new Shopify part for a pattern, then creates product variants for each sku in that pattern. It does this by POSTing and PUTing requests using the HttpWebRequest class. This was working great through yesterday afternoon, now today for some reason it's failing on the product variant creation/update with a 404 - Not Found error code.
The product add request JSON is below. This works perfectly, it creates the part on Shopify which I can then see through the admin panel. This is POSTed to the URL "https://key:password#bath-and-window-direct.myshopify.com/admin/products.json" (where key and password are replaced with our credentials)
{
"product": {
"id": 0,
"body_html": "A classic combination of embroidery and cut work form the flowing border, creating your own seaside retreat. ",
"title": "Seabreeze Sand",
"vendor": "SKL",
"product_type": "",
"published_scope": "global",
"tags": "J71227",
"variants": null,
"options": null,
"images": [{
"id": 0,
"product_id": 0,
"position": 1,
"src": "http:\/\/i320.photobucket.com\/albums\/nn353\/fkhphoto\/J71227main.jpg",
"variant_ids": null
}],
"image": null
}
}
This is the JSON reply I'm receiving after this call, and I can also see the part added in the Shopify admin panel:
{
"product": {
"id": 7874734983,
"title": "Seabreeze Sand",
"body_html": "A classic combination of embroidery and cut work form the flowing border, creating your own seaside retreat. ",
"vendor": "SKL",
"product_type": "",
"created_at": "2016-07-14T10:43:56-04:00",
"handle": "seabreeze-sand",
"updated_at": "2016-07-14T10:43:56-04:00",
"published_at": "2016-07-14T10:43:56-04:00",
"template_suffix": null,
"published_scope": "global",
"tags": "J71227",
"variants": [{
"id": 24925005383,
"product_id": 7874734983,
"title": "Default Title",
"price": "0.00",
"sku": "",
"position": 1,
"grams": 0,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"taxable": true,
"barcode": null,
"image_id": null,
"inventory_quantity": 1,
"weight": 0.0,
"weight_unit": "lb",
"old_inventory_quantity": 1,
"requires_shipping": true
}],
"options": [{
"id": 9404426823,
"product_id": 7874734983,
"name": "Title",
"position": 1,
"values": ["Default Title"]
}],
"images": [{
"id": 16242879303,
"product_id": 7874734983,
"position": 1,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"src": "https://cdn.shopify.com/s/files/1/1363/2407/products/J71227main.jpg?v=1468507436",
"variant_ids": []
}],
"image": {
"id": 16242879303,
"product_id": 7874734983,
"position": 1,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"src": "https://cdn.shopify.com/s/files/1/1363/2407/products/J71227main.jpg?v=1468507436",
"variant_ids": []
}
}
}
Immediately after that, I'm POSTing the following JSON to add a product variant to this newly created part, to the URL "https://key:password#bath-and-window-direct.myshopify.com/admin/products/7874734983/variants.json". This is the call that returns a 404 - Not Found error through the HttpWebRequest class.
{
"variant": {
"id": 0,
"product_id": 7874734983,
"title": "Seabreeze Tier Curtain in Sand",
"price": "11.99",
"sku": "J7122700013V09",
"compare_at_price": "0.00",
"position": 0,
"grams": 0,
"option1": "57X13 ROD POCKET VAL",
"option2": null,
"option3": null,
"taxable": true,
"barcode": "036326422417",
"weight": 0,
"weight_unit": "lb",
"inventory_quantity": 550,
"old_inventory_quantity": 550,
"requires_shipping": true,
"image_id": null,
"metafields": [{
"id": 0,
"key": "point1",
"value": "57 x 13 Valance",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point2",
"value": "To achieve the look in the photo, use one valance and one tier pair.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point3",
"value": "Feels like you are in your own beach cottage.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point4",
"value": "100% Polyester.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point5",
"value": " ",
"value_type": "string",
"namespace": "J7122700013V09"
}]
}
}
What am I doing wrong? The URLs, when copied into a web browser, work perfectly fine...I can see all the JSON of the current data. But when attempting to add the variant, I'm getting the 404.
Try leaving out the "id": 0 properties — both from the variant and from the metafields. Shopify will determine the IDs automatically.