When I use Graph API to access user's apprequests, /me/apprequests sometimes returns null "from" property, like the following.
{
"data" : [
{
"id" : "xxxxxx_xxxxx",
"to" : {
"name":"xxxxx xxxxx",
"id":"xxxxxx",
},
"from" : null
}
]
}
This occurs for some users data, but not always. How come this happens? All apprequests are created in same way, using Fb.ui({method: 'apprequests',...});
I've created a bug report and received an answer as follows.
It's due to privacy checks on the user who sent the request, in some
cases (user deactivated their account, user removed your app, etc) you
won't be able to read anything, including ID, about the sender of the
request.
http://developers.facebook.com/bugs/337541152923169?browse=search_4f0ad280300830331054933
Related
I am trying to pass the owner attribute to create a user story in rally using rally API But I am encountering below error.
{
"CreateResult": {
"_rallyAPIMajor": "2",
"_rallyAPIMinor": "0",
"Errors": [
"Cannot parse object reference from \"{\"Owner\": {\"_refObjectName\": \"Ron\"}}\""
],
"Warnings": [
"Ignored JSON element HierarchicalRequirement.PortfolioItem during the processing of this request."
]
}
}
My request payload
{
"HierarchicalRequirement":{
"Name": "hello Wrold",
"Description":" 123 test description",
"Workspace": "/workspace/18686460234",
"Project":"/project/1025697468602323",
"PortfolioItem":"",
"Owner":{"_refObjectName":"Ron"},
"ScheduleState":"Defined"
}
}
Any thoughts?
In general, when referring to an object property that itself is an object (as in this case with the User object), you pass in the actual value of _ref, not another object. If you have previously been passed the reference to the user as a full blown URI, then you can still pass that in and the SDK will convert it to a _ref.
If you go to the webservice docs (https://rally1.rallydev.com/slm/doc/webservice/) for your subscription and go down to the User section, you can get the docs to fetch you some examples of users. The _ref will come back something like:
https://rally1.rallydev.com/slm/webservice/v2.0/user/39776836851
I believe that you can either use that, or just truncate it to the number at the end. So the code will need to be changed so that the Owner line reads:
"Owner" : "https://rally1.rallydev.com/slm/webservice/v2.0/user/39776836851"
Here is my db.json :
{
"users": [
{
"id": "1"
"name": "John"
}
]
}
I'd like to be able to update the user id by sending a PUT request on the existing user. But the following does not work:
Request URL :
PUT /users/1
with body:
{
"id": "2"
"name": "John"
}
Is there a way to update an object id?
If you are using PUT request means ,the request URL should be like this "PUT/users/1" .
Refer below mentioned image.
I'm using postman to send put request
This does not seem to be possible, as said in documentation:
Id values are not mutable. Any id value in the body of your PUT or
PATCH request will be ignored. Only a value set in a POST request will
be respected, but only if not already taken.
I want to add AccountName custom tag defined in docusign on my document through REST API call in Apex. Here is my REST API request body
{
"status" : "sent",
"customFields" : {
"textCustomFields" : [ {
"name" : "AccountName",
"show" : "true",
"required" : "False",
"value" : "Test Account",
"customFieldType" : "text"
} ]
}
}
The URL is https://demo.docusign.net/restapi/v2/accounts/'accountId'/envelopes
I use anchor string /txtAccountName1/ which I have added on my document but it does not map to any value of the custom field AccountName related to salesforce object. For the tabs it works fine it successfully maps the signer tag to s1 and date to the d1 but for this custom field it does not map the AccountName custom tag to the anchor string /txtAccountName1/. I have created the custom tag AccountName related to salesforce object and used anchor string as /txtAccountName{r}/. I am writing the code in sandbox and using Docusign Demo Account for the integration.I am not sure about the name used in textCustomField and value I used is the reason for not getting the required result. Though the Rest API request is returning the sucess.
How can I map the AccountName value to the anchorString defined in my document?
You are mixing two things customtab and customfields. CustomFields is the metadata on an envelope, there is no tab for this and you can send text type of list type custom fields, these type of fields are not visible to a signer/recipient and is sent as metadata in an envelope, For details related to CustomFields are available at https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeCustomFields/create/
Now customTab, if you have already defined an account level customTab as "AccountName" then you can add them using REST API using below call like:
{
"textTabs": [{
"tabLabel": "AccountName",
"documentId": "83644555",
"recipientId": "84066562",
"pageNumber": 1,
"value": "AccountName",
"anchorString": "/txtAccountName1/"
}]
}
So before using the Accountlevel custom tab, you need to create it in your DocuSign account from webapp or using API - https://docs.docusign.com/esign/restapi/CustomTabs/CustomTabs/create/, Once it is created then only you can use it in an envelope.
As far as I can tell, you can't pull in the custom tag definition. You need to define the entire tag every time you use it, which means you'll need to use something like this:
"textCustomFields" : [ {
"name" : "AccountName",
"show" : "true",
"required" : "False",
"value" : "Test Account",
"anchorString": "/txtAccountName1/"
"customFieldType" : "text"
} ]
Running on DataPower 7.5.2.0
I created a JWT Generator as part of a AAA Policy and it is working fine, I am able to generate, sign and then externally verify the JWT with no issues.
Now I want to add a custom claim to the JWT, so I ticked the box for Custom and then uploaded this Gateway script file:
var claim = {
"result" : {
"user" : "hardcode"
}
};
session.output.write(claim);
and it generates the correct JWT with the user attribute. However when I try to add a second value to it like so:
var claim = {
"result" : {
"user" : "hardcode",
"name" : "myname"
}
};
session.output.write(claim);
I now get this error:
[Error: Required CustomClaim Name or Value field missing] errorMessage: 'Required CustomClaim Name or Value field missing', errorCode: '0x8580005c', errorDescription: 'GatewayScript console log message.', errorSuggestion: 'GatewayScript console log message. Refer to the message for more information.'
Which is the same message I got before I realized I had to set the output to result from the InfoCenter's vague documentation.
How do I add multiple custom claims in the JWT Generator Gateway script??
It would appear that DataPower only allows you to add a single custom claim, so you just need to make that a complex object like so:
var claim = {
"result" : {
"claim" : {
"user" : "hardcode",
"one" : true,
"clientId" : "asdf-asdf-asdf",
"endpoint" : "http://192.168.142:8080/member/ws"
}
}
};
session.output.write(claim);
This then generates the correct JWT with a nest claim.
eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGljIiwic3ViIjoiYWRtaW4iLCJleHAiOjE0ODIyNjU5ODQsImlhdCI6MTQ4MjI2MjM4NCwianRpIjoiZDhjNTE1ZDEtZmVjMS00ZGVmLThiNDctZmYzY2E2OWVjOWRiIiwibm9uY2UiOiJtN2lVZlBqTCIsImF1ZCI6ImlkMSIsImNsYWltIjp7InVzZXIiOiJmcmVkIiwib25lIjp0cnVlLCJjbGllbnRJZCI6ImFzZGYtYXNkZi1hc2RmIiwiZW5kcG9pbnQiOiJodHRwOi8vMTkyLjE2OC4xNDI6ODA4MC9tZW1iZXIvd3MifX0.viakwnM5bhhmGIn0QmDJTmsWCuIciO2BOdUVyxYpsFA
I have been trying to develop an app that takes an order on Shopify on a different channel. I successfully placed an order through the API but I am not able to include the discount code along with the order. The JSON object for the POST data is as below:
{
order: {
email : request.params.order.email, // string
financial_status : 'pending', // string
send_receipt : true, // boolean
send_fulfillment_receipt : false, // boolean
note : request.params.order.note, // string
discount_codes : [], // supposed to be an array of Object| Problem here,
line_items : request.params.order.line_items, // array
customer : request.params.customer, // JSON object
billing_address : request.params.order.billing_address, // JSON object
shipping_address : request.params.order.shipping_address // JSON object
}
}
According to the documentation, the discount_codes is like this -
Applicable discount codes that can be applied to the order. If no codes exist the value will default to blank. A Discount code will include the following fields:
amount: The amount of the discount.
code: The discount code.
type: The type of discount. Can be one of : "percentage", "shipping", "fixed_amount" (default).
What am I doing wrong? My discount_codes is this
[{amount: 100,code:'WELCOME10',type:'percentage'}]
Has anyone done this before?
According to this response from Shopify what you are trying to do is only possible if you pass the total_discounts field along as well with the total amount of the discount you want to apply.
As you will see in this other answer, any codes you have created through Shopify are not available to use with the API and their usage will not be recorded.
I was trying to use this API in order to test the application of different coupon codes that I was generating, but this does not seem to be possible. Apparently, the API was intended for applying discounts that are custom, not ones that already exist in Shopify. This is a frustrating limitation to me.
I successfully create orders with discounts all the time, without ShopifyPlus as that is irrelevant. The data structure that works for me looks like this:
[ { "code": "Shop By PizzleFuzzle 10%", amount: "10", "type": "percentage" } ]
The discount object is available only for Shopify Plus merchants.
Once you are a Shopify Plus merchant, you will be able to create discount codes like that:
POST /admin/discounts.json
{
"discount": {
"discount_type": "percentage",
"value": "15.0",
"code": "balderdash"
}
}
Please see more detailed documentation in the discount object at Shopify API: https://help.shopify.com/api/reference/discount
You should use the value property name instead of amount property name.
e.g.
{value: 100,code:'WELCOME10',type:'percentage'}
and not
{amount: 100,code:'WELCOME10',type:'percentage'}