I have installed CKAN on Ubuntu 14.04 from package and now I'm setting up the datastore.
I followed the instructions from here:
http://docs.ckan.org/en/2.8/maintaining/datastore.html.
When I test it using GET it seems okay
roderico#roderico-VirtualBox:~$ curl -X GET "http://localhost/api/3/action/datastore_search?resource_id=_table_metadata"{"help": "http://192.168.1.3/api/3/action/help_show?name=datastore_search", "success": true, "result": {"include_total": true, "resource_id": "_table_metadata", "fields": [{"type": "int", "id": "_id"}, {"type": "name", "id": "name"}, {"type": "oid", "id": "oid"}, {"type": "name", "id": "alias_of"}], "records_format": "objects", "records": [], "_links": {"start": "/api/3/action/datastore_search?resource_id=_table_metadata", "next": "/api/3/action/datastore_search?offset=100&resource_id=_table_metadata"}, "total": 0}}
but then when I do the POST it fails
roderico#roderico-VirtualBox:~$ curl -X POST http://localhost/api/3/action/datastore_create -H "Authorization: {1478356f-8f8f-4f16-a7c0-8bce46b6bece}" -d '{"resource": {"package_id": "{10aa3af0-a55c-4184-a13b-de8bb8047096}"}, "fields": [ {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2, "b": "zzz"} ]}'
with this response:
{"help": "http://192.168.1.3/api/3/action/help_show?name=datastore_create", "success": false, "error": {"message": "Access denied: <function datastore_create at 0x7f268d98baa0> requires an authenticated user", "__type": "Authorization Error"}}
It says Authorization error so I don't know may be I'm using the wrong details. Any idea?
I got the api key from the profile and the package id from the url
http://192.168.1.3/dataset/amigos/resource/10aa3af0-a55c-4184-a13b-de8bb8047096
Related
I am using WSO2 identity server 5.7.0, i am calling the api https://[url]:[port]/t/tenantName/scim2/Users GET. The response received is the following with HTTP status 200:
{"totalResults":0,"startIndex":1,"itemsPerPage":0,"schemas":["urn:ietf:params:scim:api:messages:2.0:ListResponse"]}
However, the user is not being returned, the tenant has its own admin user only. The expected response (working fine on another environment) is:
{
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 1,
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"Resources": [
{
"emails": [
"user1#gmail.com"
],
"meta": {
"created": "2023-01-05T13:01:12Z",
"lastModified": "2023-01-05T13:01:12Z"
},
"roles": [
{
"type": "default",
"value": "Internal/subscriber,Internal/creator,Internal/publisher,Internal/everyone,admin"
}
],
"name": {
"givenName": "user1",
"familyName": "user1"
},
"id": "2e86d8e6-7db8-4600-a8bc-f3h1d54d8h6a",
"userName": "user1"
}
]
}
How to fix this? Are there any configuration that should be changed to return all users?
Note: SCIM is enabled in user-mgt.xml file
Recreating a new tenant after enabling the SCIM solved the issue, but the issue remains for the tenant that was created prior to enabling the SCIM.
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'm using APIM 4.1.0. I am following this and another tutorial to create an API through publisher service API. After generating the access token I use the below command but there is no response. No error code even. Are these URLs correct?
curl -k -H "Authorization: Bearer <access-token>" -H "Content-Type: application/json" -X POST -d #data.json https://127.0.0.1:9443/api/am/publisher/v2/apis
data.json file contains:
{
"policies": [
"Unlimited"
],
"visibility": "PUBLIC",
"visibleRoles": [],
"visibleTenants": [],
"cacheTimeout": 300,
"endpointConfig": {
"endpoint_type": "http",
"sandbox_endpoints": {
"url": "http://maps.google.com/maps/api/directions/"
},
"production_endpoints": {
"url": "http://maps.google.com/maps/api/directions/"
}
},
"subscriptionAvailability": null,
"subscriptionAvailableTenants": [],
"operations": [
{
"id": "postapiresource",
"target": "string",
"verb": "POST",
"authType": "string",
"throttlingPolicy": "Unlimited",
"scopes": [
"apim:api_view"
],
"usedProductIds": [
"string"
]
}
],
"responseCachingEnabled": false,
"isDefaultVersion": true,
"businessInformation": {
"technicalOwner": "ApiCreator",
"technicalOwnerEmail": "ApiCreator#pizzashack.com",
"businessOwner": "ApiPublisher",
"businessOwnerEmail": "ApiPublisher#pizzashack.com"
},
"transport": [
"http",
"https"
],
"tags": [
"phone",
"multimedia",
"mobile"
],
"provider": "admin",
"version": "Beta",
"description": "Calculates directions between locations",
"name": "GoogleDirectionsAPI",
"context": "/googledirections"
}
You have to use v3 version as follows.
curl -k -H "Authorization: Bearer <access-token>" -H "Content-Type: application/json" -X POST -d #data.json https://127.0.0.1:9443/api/am/publisher/v3/apis
I am trying to get specific response from Compute API method instances.aggregatedList by setting the fields request param as per https://cloud.google.com/resource-manager/docs/performance#partial-response
But I am getting 400 BAD REQUEST.
Is there a sample which I can refer for getting partial response for aggregated methods?
If you use the following CURL command:
curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) "https://compute.googleapis.com/compute/v1/projects/[CHANGE-FOR-YOUR-PROJECT-ID]/aggregated/instances?maxResults=1"
You'll notice that the result will have a similar form to:
{
"id": "projects/[PROJECT-ID]/aggregated/instances",
"items": {
"zones/us-central1-a": {
"instances": [
{
"id": "[INSTANCE-ID]",
"creationTimestamp": "2020-09-21T06:22:21.604-07:00",
"name": "instance-1",
"description": "",
"tags": {
"items": [
"http-server",
"https-server"
],
"fingerprint": "XXXXXX"
},
"machineType": "https://www.googleapis.com/compute/v1/projects/[PROJECT-ID]/zones/us-central1-a/machineTypes/e2-medium",
"status": "RUNNING",
"zone": "https://www.googleapis.com/compute/v1/projects/[PROJECT-ID]/zones/us-central1-a",
"canIpForward": false,
"networkInterfaces": [
{
"network": "https://www.googleapis.com/compute/v1/projects/[PROJECT-ID]/global/networks/default",
"subnetwork": "https://www.googleapis.com/compute/v1/projects/[PROJECT-ID]/regions/us-central1/subnetworks/[SUBNETWORK_NAME]",
"networkIP": "10.8.0.13",
"name": "nic0",
... with a lot more fields
As you can see the result is a little bit different as the response body explained in the documentation:
{
"id": string,
"items": [
{
"scopeName": string,
"instances": [
{
"id": string,
"creationTimestamp": string,
"name": string,
"description": string,
"tags": {
"items": [
string
],
"fingerprint": string
},
"machineType": string,
"status": enum,
"statusMessage": string,
"zone": string,
"canIpForward": boolean,
"networkInterfaces": [
{
"network": string,
"subnetwork": string,
"networkIP": string,
"ipv6Address": string,
"name": string,
.... with a lot more fields
Notice that if you compare both results, the actual response that you receive has an additional "zones/us-central1-a": field before the instances: field that I believe is causing the behavior you experience.
If you are interested in working with partial resources and get only some particular fields on the response you simply need to respect the syntax rules explained on the documentation you've shared and use the escape characters accordingly on your query parameters.
E.g. if you are only interested in getting the id of your project as well as the instances' name, machineType and status I tested the following curl command from the Cloud Shell with my GCP project and it worked without issues:
curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) "https://compute.googleapis.com/compute/v1/projects/[PROJECT-ID]/aggregated/instances?fields=id,items/zones%2Finstances(name,machineType,status)"
where I see that something similar to the following is returned:
{
"id": "projects/[PROJECT-ID]/aggregated/instances",
"items": {
"zones/us-central1-a": {
"instances": [
{
"name": "instance-1",
"machineType": "https://www.googleapis.com/compute/v1/projects/[PROJECT-ID]/zones/us-central1-a/machineTypes/e2-medium",
"status": "RUNNING"
},
{
"name": "instance-2",
"machineType": "https://www.googleapis.com/compute/v1/projects/[PROJECT-ID]/zones/us-central1-a/machineTypes/e2-medium",
"status": "TERMINATED"
}
]
}
}
}
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.