We are sending PATCH request to a server in SCIM specification.
As per the SCIM specifications, the request should contain following attributes in PATCH request.
op
path
value
So if we are changing the 'givenName' attribute from core schema then the PATCH request will be in following way, (ref: https://www.rfc-editor.org/rfc/rfc7644#section-3.5.2)
{
"schemas" : ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations":[
{
"op":"replace",
"path":"name.givenName",
"value":"Ravindra"
}
]
}
Now what should be the 'path' attribute if are modifying any SCIM extension, let's say enterprise extension.
Is the following representation is correct for enterprise extension?
{
"schemas" : ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations":[
{
"op":"replace",
"path":"urn:ietf:params:scim:schemas:extension:enterprise:2.0:user.department",
"value":"Engineering"
}
]
}
As in the ABNF to which scim filters should adhere (see section 3.4.2.2 of RFC 7644), when you refer to an attribute part of an extension you should do URI:attribute_path, so in your case this is "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:department"
I was getting a similar error when attempting to PATCH the "active" value of an enterprise user. The solution is simple: change your "path" value in the example above to simply "department".
For completeness, here's the PATCH body that worked for me in Postman:
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op":"replace",
"path":"active",
"value":"false"
}
]
}
Attribute '.Operations.[].value' must be of type hash
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"Operations": [
{
"op": "replace",
"value": {
"active": false
}
}
]
}
Hope this will work!!
Related
In a legacy system I found this JSONPath :
$['data']..['rels'][?]['persons'][*]
I am confused by [?],
as I am trying to rebuild the expected JSON that should by like (but it's not) :
{
"tag1": ["VALUE1"],
"data": [
{
"tag2": "VALUE2",
"rels": [
{
"persons": [
{
"uid": "uid12"
}
],
"tag3": {
"tag4": "tag4"
}
}
]
}
]
}
I used https://jsonpath.com/
Thanks for your help
You're right to be confused by this. It's not valid JSON Path syntax. It's an extension syntax supported by Jayway JsonPath (a JavaScript implementation) that they call "Filter Predicates." You can read about it in the project's readme.
I and a few others have been working on writing an official specification for JSON Path, and I brought this up recently after having seen another question around it. This kind of confusion is something we aim to avoid.
Context :
I have a machine with Orion Context Broker, Cygnus and Ckan. I have 3 entities (sensor1, sensor2, sensor3) and I use name mappings for these three entities to write in a single Ckan datastore named sensors. So far everything works.
What I want :
These 3 entities are in the fiware-service default and I want them to write in the fiware-service paris (the paris organization in Ckan)
Question :
How to make the name mapping change the default fiware-service of these 3 entities into paris, without changing it for all entities?
What I tried :
I tried this, the problem with this code is that all entities of the fiware-service default are moved to the fiware-service paris, not just my trhee entities.
{
"serviceMappings": [
{
"originalService": "default",
"newService": "paris",
"servicePathMappings": [
{
"originalServicePath": "/",
"entityMappings": [
{
"originalEntityId": "sensor1",
"originalEntityType": "device",
"newEntityId": "sensors",
"attributeMappings": []
},
{
"originalEntityId": "sensor2",
"originalEntityType": "device",
"newEntityId": "sensors",
"attributeMappings": []
},
{
"originalEntityId": "sensor3",
"originalEntityType": "device",
"newEntityId": "sensors",
"attributeMappings": []
}
]
}
]
}
]
}
Looking to the examples in the Cygnus documentation maybe you could try with a regular expression pattern:
Last but not least, the original names support Java-based regular expressions.
For instance:
{
"serviceMappings": [
{
"originalService": "default",
"newService": "paris",
"servicePathMappings": [
{
"originalServicePath": "/",
"entityMappings": [
{
"originalEntityId": "sensor[1-3]",
"originalEntityType": "device",
"newEntityId": "sensors",
"attributeMappings": []
}
]
}
]
}
]
}
I'm not fully sure it works for you but it may help...
I'm trying to specifiy the constructor to use in autofac json configuration file.
By code a can use the UsingConstructor(...) method.
I tried different configuration but no one works.
Example of my tests :
{
"type": "BlueCurve.Search.Messaging.PubSub.Producer, BlueCurve.Search.Messaging",
"services": [
{
"type": "BlueCurve.Search.Messaging.Abstraction.IProducer, BlueCurve.Search.Messaging.Abstraction",
"constructor": "System.String, System.Guid, System.String, BlueCurve.Search.Messaging.Abstraction.IAmqpConnectionFactory"
}
]
}
{
"type": "BlueCurve.Search.Messaging.PubSub.Producer, BlueCurve.Search.Messaging",
"services": [
{
"type": "BlueCurve.Search.Messaging.Abstraction.IProducer, BlueCurve.Search.Messaging.Abstraction",
"using-constructor": "System.String, System.Guid, System.String, BlueCurve.Search.Messaging.Abstraction.IAmqpConnectionFactory"
}
]
}
{
"type": "BlueCurve.Search.Messaging.PubSub.Producer, BlueCurve.Search.Messaging",
"services": [
{
"type": "BlueCurve.Search.Messaging.Abstraction.IProducer, BlueCurve.Search.Messaging.Abstraction"
}
],
"using-constructor": "System.String, System.Guid, System.String, BlueCurve.Search.Messaging.Abstraction.IAmqpConnectionFactory"
}
Thanks you for your help!
JSON configuration doesn't support specifying constructor. Config isn't a feature for feature replacement for code based setup. See documentation here.
It's really hard to find a clear answer about how to create a comment on an issue which is internal only.
The JIRA Cloud REST API Documentation specifies the following schema for setting properties on comments when creating or updating a comment on an incident
https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/comment-addComment
"properties": {
"type": "array",
"items": {
"title": "Entity Property",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {}
},
"additionalProperties": false
}
}
To make a comment on an issue internal (meaning only service desk agents can see the comment) you need to set the sd.public.comment key to have the value { "internal": true }
Which can be achieved by passing the following JSON in the body of the create or update API request.
{
"properties": {
"key": "sd.public.comment",
"value": {
"internal": true
}
}
}
You will also need to set the Content-Type header on the request.
Content-Type: application/json
The following is an example of a creating an internal comment using a Groovy script - the scripting language used by ScriptRunner (a popular JIRA plugin)
post("/rest/api/2/issue/${issue.id}/comment")
.header("Content-Type", "application/json")
.body([
body: "This is the text which will appear in the comment",
properties: [
[key: "sd.public.comment", value: [ "internal": true ]]
]
]).asString()
Note that Object / JSON mapping will differ depending on which scripting language or HTTP Request framework you are using.
Contentful is a very useful service but unfortunately the json response format does not allow for standard expanded json data format.
It requires us to write and extra translator to return common json structure nesting.
For instance, with Contentful we get (simplified version)
{
"module" : {
"lessons" : [
"id": "<lesson_id>"
]
}
"includes": {
"Entry": [
{
id: "<lesson_id>",
lesson : {
"lesson data" : "lesson data",
topics : [
"id" : "<topic_id>"
]
}
},
id: "<topic_id>",
topic : {
"topic data" : "topic data",
]
}
}
]
}
But we want this
{
"module" : {
"lessons" : [
{
"lessonData" : "lesson data",
"topics" : [
{
"topicData" : "topic data",
}
]
}
],
}
}
Anyone have a generalized tool to assemble a Contentful response into a standard json response?
Have you used any of our SDKs? They have Include resolution built-in so that you don't have to do this manually.
There are many tools built already with them to, for example, serialize content to YAML (using a format similar to what you describe) so that static site generators can consume from it.
You can read more about this on our developers page: https://www.contentful.com/developers/docs/
Hope this helps