I'm able to post data "title" and "sequence" using POST in postman.
However, how should I post the image? What about multiple images as well?
I've tried using
1)Body with form-data, img as key and place a file in it, however the img is still null. Response:
{
"title": "test title 2",
"sequence": 5,
"_id": "5bd1658f39702a5df8a1e447",
"createdAt": "2018-10-25T06:41:19.197Z",
"updatedAt": "2018-10-25T06:41:19.358Z",
"__v": 0,
"img": null,
"id": "5bd1658f39702a5df8a1e447"
}
2) Convert the image to base 64 string and post it as json:
Request:
{
"title": "test title 3",
"sequence": 6
"img": "base64stringxxxxx"
}
Response:
{
"message": "An internal server error occurred",
"statusCode": 500,
"error": "Internal Server Error"
}
Related
I am using the graph api (through android SDK and graph explorer) to get a page's posts, when I get to a post of a page that has multiple images in a post it becomes an album.
Example post response
"message": "Test Multi-Photos",
"full_picture": "",
"from": {
"name": "TestPage",
"id": ""
},
"attachments": {
"data": [
{
"media_type": "album",
"media": {
"image": {
"height": 405,
"src": "",
"width": 720
}
},
"type": "album",
"title": "Photos from TestPage's post",
"target": {
"id": "147710857059579",
"url": ""
}
}
]
},
"id": "_147710857059579"
}
When I try to use the target.id to get the album photos
I believe the url would look like this
https://graph.facebook.com/147710857059579
I get a response saying that the endpoint is deprecated
{
"error": {
"message": "(#12) singular statuses API is deprecated for versions v2.4 and higher",
"type": "OAuthException",
"code": 12,
"fbtrace_id": "AhhiY7ohbb5SoXdFNDZnHhU
"
}
}
Documentation does not say anything about it being deprecated so how do you get the album photos?
To get photos from an album post you have to add subattachments to the attachments fields in the query.
Example using the Android SDK
parameters.putString("fields", "message,full_picture,from,place,attachments{media_type,media,type,title,description,target,subattachments}")
parameters.putString("limit", "10")
I have a working Hyperledger-Fabric environment, running locally on my Mac. I setup the chaincode_example02 code, but the Query REST call isn't working. I trying doing a deploy and invoke and both of those calls work. I am using Postman to send the REST calls.
Query:
{
"jsonrpc": "2.0",
"method": "query",
"params": {
"type": 1,
"chaincodeID": {
"name": "mycc",
"path": "/tmp/hyperledger-BR/example0/gopath/src/github.com/chaincode_example02/chaincode_example02"
},
"ctorMsg": {
"function": "query",
"args": ["b"]
}
},
"id": 0
}
Serverside Error:
Error starting Simple chaincode: Error handling message:
[ef980ad7-94c8-4ec9-92f4-3ebdd47e4321]Chaincode handler FSM cannot
handle message (RANGE_QUERY_STATE) with payload size (10) while in
state: ready
Postman Returned Error:
{ "jsonrpc": "2.0", "error": {
"code": -32003,
"message": "Query failure",
"data": "Error when querying chaincode: Error:Failed to execute transaction or query(Timeout expired while executing transaction)"
}, "id": 0 }
I have been digging online, but I have no idea why this is happening. Any clue as to why this is happening?
When i try to handling the response from server, I cant able to read the error status and detail (i.e., those fields are empty)
Below i show my response what i am getting,
{
"message": "Ember Data Request POST http://192.168.1.21:8888/api/test returned a 0?Payload (Empty Content-Type)?",
"name": "Error",
"errors":
[
{
"detail": "",
"status": "0",
"title": "The backend responded with an error",
}
],
"description":undefined,
"fileName":undefined
}
Why this fields are empty? what should i do to overcome this?
i am trying to use the redmine API to create new issue via code,
just to test it i am trying to send the data to the API using postman.
i have used amazon to host it.
I try send json via post method. (using postman -plugin for chrome)
url:- http://{user_name}:{password}#xxxredmine_urlxxx/issues.json
type:- POST
Body:-
{
"issue": {
"project_id": 1,
"subject": "New ticket via API",
"description": "API test 27\/6",
"status_id": 1,
"priority_id": 3,
"assigned_to_id": 5
}
}
it creates a ticket successfully but never sets an assignee
{
"issue": {
"id": 61,
"project": {
"id": 1,
"name": "EasySoft"
},
"tracker": {
"id": 1,
"name": "Bug"
},
"status": {
"id": 1,
"name": "New"
},
"priority": {
"id": 3,
"name": "High"
},
"author": {
"id": 1,
"name": "UserName LastName Admin"
},
"subject": "New ticket via API",
"description": "API test 27/6",
"start_date": "2016-06-27",
"done_ratio": 0,
"custom_fields": [
{
"id": 2,
"name": "Customer name",
"value": ""
}
],
"created_on": "2016-06-27T09:37:58Z",
"updated_on": "2016-06-27T09:37:58Z"
}
}
i have tried changing assigned_to_id to
"assigned_to":{"id":5}
Thank you in advance.
This is an old question but potentially still useful to answer... are you certain that the user you are attempting to set as the assignee is in an assignable role on that specific project? Unfortunately, the Redmine REST API will respond with a 200 OK even if you give it a non-assignable user, so there's no indication that it was unable to successfully set the user as the assignee.
Im using the Graph API to get certain data from my managed pages.
What i need is the likes, checkins and talking_about_count from my pages.
When i add checkins and talking_about_count i get an error that the API doesn't know the fields.
So i removed those and only asked for the likes and id.
What the API returns is a list with the posts from the page and only showing the id, creation date and the likes(if there are any).
I tested with some other fields like about and website, but they give the same error as checkins and talking_about_count, so i can't get basic data from my pages..
The link i use is this:
https://graph.facebook.com/168707433219493/feed?access_token=[Access_Token]&fields=id,likes,checkins,talking_about_count
And the error i get:
{
"error": {
"message": "(#100) Unknown fields: checkins,talking_about_count.",
"type": "OAuthException",
"code": 100
}
}
When i only ask for id and likes i get:
{
"data": [
{
"id": "168707433219493_333476503426186",
"created_time": "2012-11-28T19:38:57+0000"
},
{
"id": "168707433219493_370257573064477",
"created_time": "2012-11-22T08:12:11+0000"
},
{
"id": "168707433219493_423778884356339",
"likes": {
"data": [
{
"name": "Guido van Tricht",
"id": "1117357415"
}
],
"count": 1
},
"created_time": "2012-11-19T22:46:01+0000"
}
],
"paging": {
"previous": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&since=1354131537&__previous=1",
"next": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&until=1350819853"
}
}
I hope someone knows how to solve my problem, thanks in advance.
talking_about_count should be in the /PAGE_ID, not in the feed.
Why not get this data from:
https://graph.facebook.com/168707433219493?access_token=[Access_Token]