Mapping without KVC , RestKit version:0.27.0 - ios

I have a JSON data without a key on the top level, I need to POST it to our server, but how could I map that using RestKit (version: 0.27.0):
e.g.
[
{ "title": "RestKit Object Mapping Intro",
"body": "This article details how to use RestKit object mapping...",
"author": {
"name": "Blake Watters",
"email": "blake#restkit.org"
},
"publication_date": "7/4/2011"
}
]
PS: I've seen some workaround on this issue, but unfortunately, none of them could work for the newest version 0.27.0.
Thanks in advance

Related

MS graph api schema extension filter bug with outlook resources (messages, events, contacts)

When trying to filter for a custom created schema extension:
https://graph.microsoft.com/v1.0/me/events?$filter=(<schemaId>/<key> eq '<value>')
the error message we get is:
"message": "Could not find a property named 'e2_<ourTenantID>_<schemaId>' on type 'Microsoft.OutlookServices.Event'"
The problem is that before performing search, the API prepends tenantID to schema ID, thus failing to recognize the property. It seems that graph API performs search using their own internal schema ID.
Interesting thing is, that when searching for a non-existing schema, the tenantID is not added.
The problem persists when testing to filter messages, events and contacts.
Our schema extension creation JSON:
{
"description": "Extension to help avoid duplicates",
"targetTypes": [
"Contact",
"Message",
"Event"
],
"properties": [
{
"name": "UniqueId",
"type": "String"
}
],
"status": "InDevelopment",
"owner": "<appID>",
"id": "<name>",
"#odata.type": "#microsoft.graph.ComplexExtensionValue"
}

Getting project category based on project key from jira rest api

We are developing a web project to get a list of project category for a particular project key for jira using their rest api and update it.
I can not find any appropriate api for the same.
Has anybody done something like this.
Thanks in advance.
The JIRA REST API documentation mentions this plain and simple.
Retrieving project info
Use GET /rest/api/2/project/{projectIdOrKey} to get details about a specific project. This response will also contain info about the project category, ie.:
"projectCategory": {
"self": "http://www.example.com/jira/rest/api/2/projectCategory/10000",
"id": "10000",
"name": "FIRST",
"description": "First Project Category"
}
Updating a project
To update the category, use PUT /rest/api/2/project/{projectIdOrKey}
You can include the id of the desired category in the request body, ie.:
{
"key": "EX",
"name": "Example",
"projectTypeKey": "business",
"projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-project-management",
"description": "Example Project description",
"lead": "Charlie",
"url": "http://atlassian.com",
"assigneeType": "PROJECT_LEAD",
"avatarId": 10200,
"issueSecurityScheme": 10001,
"permissionScheme": 10011,
"notificationScheme": 10021,
"categoryId": 10120
}

Dart Services API: how to access the /fixes through the API service?

I am looking at:
https://github.com/dart-lang/dart-services
And am trying to adapt the example given (https://dartpad.dartlang.org/2a7fd9328e0a567ee79b) to pull back information from '/api/dartservices/v1/fixes' rather than '/api/dartservices/v1/analyze'.
Apologies, if I am missing something obvious here but changing the path in the example to:
"https://dart-services.appspot.com/api/dartservices/v1/fixes";
returns an error. Does anyone know how I can get the information from '/api/dartservices/v1/fixes rather than '/api/dartservices/v1/analyze'? Or does anyone have an example of this working?
Thanks.
Sending a POST request to https://dart-services.appspot.com/api/dartservices/v1/fixes with the data the DartPad example sends yields the error message "Missing parameter: 'offset'".
Looking at the discovery doc for the service https://dart-services.appspot.com/api/discovery/v1/apis/dartservices/v1/rest I see both analyze and fixes operations take a SourceRequest:
"SourceRequest": {
"id": "SourceRequest",
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "The Dart source.",
"required": true
},
"offset": {
"type": "integer",
"description": "An optional offset into the source code.",
"format": "int32"
},
"strongMode": {
"type": "boolean",
"description": "An optional signal whether the source should be processed in strong mode"
}
}
offset is not marked as required so maybe there is a bug in the implementation of fixes wrt that parameter.
To make the DartPad example work, change:
Map m = {'source': textArea.value};
to
Map m = {'source': textArea.value, 'offset': 0};

Error in Google SDTT: "All values provided for url must point to the same page."

I am trying to create some JSON-LD structured data for a list of products on an ecom-site but I am getting an error when using Google's Structured Data Testing Tool.
So far, I have this:
{
"#context": "http://schema.org",
"#type": "OfferCatalog",
"name": "Fresh Fruit",
"itemListElement": [
{
"#type": "ListItem",
"position": 1,
"item":
{
"#type": "Offer",
"price": "1.20",
"priceCurrency": "GBP",
"availability": "http://schema.org/InStock",
"url": "http://example.com/green-apples/",
"itemOffered": {
"#type": "Product",
"name": "Green Apples",
"url": "http://example.com/green-apples/"
}
}
}
]
}
Mostly it validates, but the Google tool throws the following error:
All values provided for url must point to the same page.
The error highlights line 11 ("#type": "Offer",).
The URL fields seem to be clashing with the #context declaration, because if I change the context to either a non-url string or http://example.com, it validates (although, this obviously causes its own issues). (This has been shown to be a red-herring, in the comments below)
What am I missing here? It feels like something blindingly obvious.
I think it is connected with pushing of accelerated mobile pages and its structured data.
Please check my thoughts here: All values provided for URL must point to the same page. My guess was about the problem in Google’s SDTT
So, to fix the problem with your structure data, please use the correct version of ItemList (there are Separately and Combined marked up ItemLists, please check here):
If your items are on the same page, please use the version with items
inside, the Combined one.
Otherwise, if you point to different pages inside and your items are
not on one page, please DON’T put item element with type and other
description inside, the Separately marked up one.
Now it's 2018.
Answer by Yash Pal above is close, but not quite right.
This is not an error from Google validator tools.
The error is valid and you need to fix it.
You use the "Single Page" approach ( there are two approaches "Summary page" and "Single page" )
For "Single Page" approach, you need each URL to be exactly same, and each of them should have "an anchor".
The Google developer doc clearly mentioned it.
I wrote the explanation details there
If your page contains some links to another page, then you should use "Summary Page" approach and it had different data structure ( much simpler one, I think )
I think the issues occurs when we mix two list types i.e Summary page + multiple full details pages and A single, all-in-one-page list.
Google stated on page - https://developers.google.com/search/docs/guides/mark-up-listings
If this is a summary page, the ListItem should include only the type,
position, and url properties.
If this is an all-in-one-page list, the ListItem should include all the additional schema.org properties for the data type that it describes (for example, Recipe or Course objects).
But Google should consider eCommerce category's product listing where people display numbers of product with more than 3 properties on summery page and these are obvious for eCommerce, like price and image are 2 important item on product listing page except the 3 listed above.
So we need to raise this issue with Google to address the concern.
No, it is NOT an error in Google's SDTT,
I have helped many people fix their structured data, including dynamic arrays. Read the instructions. Google clearly states "All values for the URL must point to the same page". Think about it, Google is trying to tell you something.
That something means this "Hey you are using a different item list from the example we provided, your item list has more than two item".
The solution:
Use anchors! Voila!
Please use this example snippet and you cannot go wrong. And another tip; use the Fetch Url option from SDTT:
<script type="application/ld+json">
/*structerd data markup compiled by http://www.iwanross.co.za */
{
"#context": "http://schema.org",
"#type": "ItemList",
"itemListElement": [
{
"#type": "ListItem",
"position": 1,
"item": {
"#type": "Recipe",
"url": "https://www.smokingchimney.com/#beetroot",
"name": "Beetroot Side Salad for the braai",
"image": "http://www.smokingchimney.com/recipe-pages/images/1x1/Beetroot-Salad-
for-the-Braai-800x451.jpg",
"author": {
"#type": "Person",
"name": "Marna Ross"
},
"datePublished": "2018-10-05"
}
},
{
"#type": "ListItem",
"position": 2,
"item": {
"#type": "Recipe",
"url": "https://www.smokingchimney.com/#carrot",
"name": "Carrot Cake",
"image": "http://www.smokingchimney.com/recipe-pages/images/16x9/carrot-cake-
recipe-picture-1024x576.jpg",
"author": {
"#type": "Person",
"name": "Marna Ross"
},
"datePublished": "2018-10-05"
}
},
{
"#type": "ListItem",
"position": 3,
"item": {
"#type" : "Recipe",
"url":"https://www.smokingchimney.com/#overnight",
"name": "Overnight Steak Marinade",
"image": "http://www.smokingchimney.com/recipe-pages/images/1x1/Overnight-steak-
marinade-700x465.png",
"author": {
"#type": "Person",
"name": "Marna Ross"
},
"datePublished": "2009-10-05"
}
}
]
}
</script>
It is surely an error in the validator. I checked with the examples google provided: https://developers.google.com/search/docs/guides/mark-up-listings .
If you click on the 2nd example you will see that it has the same error.
The error is shown even if you use 1 item:
{
"#context": "http://schema.org",
"#type": "ItemList",
"itemListElement": [
{
"#type": "ListItem",
"position": 1,
"item": {
"#type": "Recipe",
"url": "http://example.com/desserts/pies/#apple-pie",
"name": "Apple Pie",
"image": "https://example.com/300px-Apple_pie.jpg",
"author": {
"#type": "Person",
"name": "Carol Smith"
},
"datePublished": "2009-11-05"
}
}
]
}
you don't need to anchor every URL, you can add parameters to the URL as well ?i=1
like:
https://website.com/d/link?i=1
https://website.com/d/link?i=2
....
Use type OfferCatalog instead of ItemList. https://schema.org/OfferCatalog

Updated RKRelationship Mapping with RestKit

I've been diving into RestKit lately but since the newest version came out so recently, all the tutorials I've found both on their github and just on the web are all for old versions. Normally that's not a problem but a lot of classes that used to exist now don't, which of course, makes all the tutorials useless.
For the sake of everyone that uses it, for the newest version of RestKit, how would you relationship map this sample JSON?
{
"entities": {
"message": [
"dentist appointment"
],
"dateRange": [
{
"start": "2012-11-15",
"end": "2012-11-16"
}
],
"time": [
"02:00:00PM"
]
},
"action": "REMINDER_SET",
"category": "REMINDER"
}
Upvote this if you have the same question.

Resources