Quantcast
Channel: DreamFactory Forum - Latest topics
Viewing all 1524 articles
Browse latest View live

What causes context.GetServicesAsync().Result to return null?

$
0
0

@David_Austin wrote:

I’m trying to get the demo program to Address Book with ASP.NET to run on my local PC. As far as I can tell I have followed all the setup instructions and can access the API using “API Docs” screen. When I run the .net app with debugging from visual studio, the LoginDemo() method works and reports successful login for my admin user. Next the DiscoveryDemo() method runs, but it fails to retrieve a services object (null result) using the call

IEnumerable services = context.GetServicesAsync().Result;

Then the method fails when it tries to enumerate the services object.

Am I missing a configuration setting somewhere within DreamFactory or the visual studio project? Thanks for the help.

Posts: 1

Participants: 1

Read full topic


Http Service call with multiple parameters

$
0
0

@jongwoo1130 wrote:

Dreamfactory v2.9.0

Using HTTP Service type, my Dreamfactory is connected with an external web service.
Currently, if I pass one parameter to the service, it returns the data correctly.
However, if I pass multiple parameters to the service, it returns an error “Parameter ‘q’ was specified more than once”.
Example: http://localhost/api/v2/{serviceName}?q=value1%20value2

Is there any way that I can configure the service to allow multiple values for a parameter?

Posts: 1

Participants: 1

Read full topic

Loading Custom Service Type

$
0
0

@jrefi wrote:

I am attempting to develop my own custom File Service type for interacting with Google Cloud Storage. For reference I borrowed heavily from the AWS S3 Service, and I think I have the underlying code at a good place. What I can’t figure out is how to get DreamFactory to recognize my Service Type. I added my PHP package to composer.json, and if I look in the admin panel, I see my package as loaded. However, my custom service is not showing up in the dropdown when I attempt to create a service. I don’t see any relevant error messages in the log file. Am I missing something?

For reference, my custom module code is located at https://github.com/singularcuriosity/df-gcloud

I am also running DF in a Docker container rather than installing locally if that matters.

Posts: 2

Participants: 1

Read full topic

Resources posted via api response id 0

$
0
0

@stefan1st wrote:

Hey,

i am new to DreamFactory and i have a problem with the API. Testing out the API and posting new entries to a tables called hosts results in a 200 with a response that contains an id of 0.

We are using DreamFactory 2.8.1. The Server runs CentOS, MySQL 5.6, Apache.

Do you have any clue what could go wrong? All i read pointed out that the response should contain the IDs of the newly created entries.

Thanks for taking the time.
Stefan

Posts: 1

Participants: 1

Read full topic

NodeJS throwing error code 127

$
0
0

@jongwoo1130 wrote:

Running Dreamfactory on CentOS 7:

I have an issue with server side scripting where running NodeJS script throws an error, “Executed command returned with error code: 127”. Creating a service with NodeJS is running fine but when I run a post process in NodeJS script to customize a native api, it throws an error code 127.

Enabling the DEBUG mode seems not capturing details of this error. Is there anyway that I can check details of this error?

Posts: 2

Participants: 1

Read full topic

REST API POST successful , but i get error 500 "message": "array_merge(): Argument #1 is not an array"

$
0
0

@abhijit wrote:

As mentioned in title, I am trying to crate a record.
I tried various combinations and kept getting the following

{

“error”: {
“code”: 1000,
“context”: {
“error”: [
0
],
“resource”: [
{
“code”: 500,
“message”: “array_merge(): Argument #1 is not an array”
}
]
},
“message”: “Batch Error: Not all requested records could be retrieved.”,
“status_code”: 500
}
}

Later i was checking something else in the DB and found all the records actually made it to the table .
So essentially, the POST was successful , but API returned above error.

API endpoint :: POST http://mydomain/api/v2/schema/_table/tableName?fields=*

Any help is really appreciated.

Posts: 3

Participants: 1

Read full topic

"We will rock you" bug - Every 3rd response empty

$
0
0

@zynchro wrote:

The API script is on V8JS, and worked fine, and continued to do so.
About a week back this issue came up where it consistently returned an empty body on every 3rd request.
I’d go to my REST client and keep clicking send for the same endpoint, and every THIRD response is simply blank.
eg:
1 - POST /url/api/login
200 OK - { “session token” : … }
2 - POST /url/api/login
200 OK - { “session token” : … }
3 - POST /url/api/login
200 OK -

the headers change too on the failed call;
FAIL:
Date: Sun, 29 Oct 2017 03:32:31 GMT
Server: Apache
X-Powered-By: PHP/7.0.13
X-Frame-Options: SAMEORIGIN
Vary: Cookie
Content-Length: 0
Content-Type: text/html; charset=UTF-8

Success:
Date: Sun, 29 Oct 2017 03:32:50 GMT
Server: Apache
X-Powered-By: PHP/7.0.13
Cache-Control: no-cache
X-Frame-Options: SAMEORIGIN
Vary: Cookie
Transfer-Encoding: chunked
Content-Type: application/json

I restarted the server after this and it seemed to have fixed the problem.
Then the issue came back today.

Any idea what’s causing it and how I can prevent it?

Posts: 2

Participants: 1

Read full topic

Error 500 . Cant load anything in dashboard


Service not shown on Role Access tab

$
0
0

@Sidhi_Artha wrote:

We are developing API using Dreamfactory, this is our first project with Dreamfactory. Pardon us if the question was too common.

We create our custom services to build the API response from several table.

The problem occur with our 51st services. The services was shown on page 2 at the services page. But not shown when we want to set the services to user Role, where the first 50 service was there.

DreamFactory Version: 2.7.0

If there are something unclear feel free to ask.

I have ask the same question on stackoverflow here

Thanks for the help

Posts: 1

Participants: 1

Read full topic

System resources: difference between custom and lookup?

$
0
0

@aurerua wrote:

Hi,

What is the difference between these two resources available from api/v2/system/: custom and lookup?

Do they have a different purpose?

One thing I have noticed is that, although they both expect the value to be a string, the customs allow an object as a value (this contradicts their schema by the way) .

Thanks in adavnce!

Posts: 1

Participants: 1

Read full topic

Error posting data with TIMESTAMP datatype to Apache Cassandra

$
0
0

@Wladimir_Cabarcas wrote:

Dear Community,

I’m exploring DreamFactory features to expose Cassandra tables as RESTful interfaces, everything is good when I do GET calls, but when I do POST calls to put records to cassandra table I have a issue when I include table with TIMESTAMP datatype:

This is the request:
POST: post /ds/_table/{table_name} createDsRecords() - Create one or more records

I put the body with this values to the table api_weather_events:

{
“resource”: [
{“station”: “0057015010”, “sensor”: “0103”, “event_time”: “2017-08-20 23:00:00-0000”, “event_value”: 18.27}
]
}

The curl POST is:

curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ --header ‘X-DreamFactory-Api-Key: 36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88’ --header ‘X-DreamFactory-Session-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJiOTdmMDBhNWU4MWFlZjhkM2EzODJjZGM2ZTI5Njc0NyIsImlzcyI6Imh0dHA6Ly8xNzIuMTYuNTAuNTIvYXBpL3YyL3N5c3RlbS9hZG1pbi9zZXNzaW9uIiwiaWF0IjoxNTEwMzIwNjgxLCJleHAiOjE1MTAzMjQyODEsIm5iZiI6MTUxMDMyMDY4MSwianRpIjoiZ1ZqTmUxR0hYUTVXdGVmWCIsInVzZXJfaWQiOjEsImZvcmV2ZXIiOmZhbHNlfQ.LcSedPzKmw10uWQg5InNfOCUyNBwR0YgItkWvlEiRyc’ -d ‘{
“resource”: [
{“station”: “0057015010”, “sensor”: “0103”, “event_time”: “2017-08-20 23:00:00-0000”, “event_value”: 18.27}
]
}’ ‘http://172.16.50.52/api/v2/ds/_table/api_weather_events

Which works doing call to API.

But the table show the following data:

cassandra@cqlsh:raw> select * from api_weather_events where station=‘0057015010’;

station | sensor | event_time | event_value
------------±-------±-------------------------------------±------------
0057015010 | 0103 | datetime.datetime(1503, 9, 27, 0, 0) | 18.27

(1 rows)
Failed to format value datetime.datetime(1503, 9, 27, 0, 0) : year=1503 is before 1900; the datetime strftime() methods require year >= 1900

You can see that the data is not stored correctly.

Doing the same operation inside Cqlsh using JSON feature the results data stored are as expected:

cassandra@cqlsh:raw> insert into api_weather_events JSON ‘{“station”: “0057015010”, “sensor”: “0103”, “event_time”: “2017-08-20 23:00:00-0000”, “event_value”: 18.27}’ ;

cassandra@cqlsh:raw> select * from api_weather_events where station=‘0057015010’;
station | sensor | event_time | event_value
------------±-------±-------------------------±------------
0057015010 | 0103 | 2017-08-20 23:00:00+0000 | 18.27

(1 rows)

What I’m doing wrong with datatype in JSON Body for dream factory, maybe can be a bug from DataStax driver.

Any help will be appreciated.

Thanks

Wladimir

Posts: 1

Participants: 1

Read full topic

Image uploaded via REST API is always corrupt

$
0
0

@wmcbruce wrote:

I have been trying for a few hours to get the image upload API to work correctly. Running DF2.10 on Amazon ECS. I can use the files area of the admin portal and upload fine. When I try to upload using the REST API, the file is always corrupted.

I have read all of the posts on this already, and none seem to address this fully.

I am using the POST/{file path} method for this.

My method parameters are:
file_path: folder_name/user.png

with this in the body:

{
    "resource": [{
	    "name": "user.png",
	    "type": "file",
	    "is_base64": true,
	    "content": "base64 string of converted png"
    }]
}

The post is successful, and I get this response body:

{
    "name": "user.png",
    "path": "folder_name/user.png",
    "type": "file"
}

I can see the file in the files area. But if I click the file, it does not render. Downloading the file and opening it in Preview.app yields an error stating “It may be damaged or use a file format that Preview doesn’t recognize.”

I have tested the base64 string on multiple converters and not had any issues.

I get the same results using Postman to test the API.

Using this page as a guide and no luck.

Would appreciate any guidance.

Posts: 1

Participants: 1

Read full topic

BUG df-api-docs-ui (accept/content-type)

$
0
0

@cgeorges wrote:

Hi all,

In the api_doc web application, when I change the “Response content type” parameter (ex: application/xml), the “Example Model” of the body parameter also changes.
But the ‘Parameter content type’ didn’t changed.
Result: I send a body ‘application/xml’ with 'Content-Type: application/json’
It’s not really a bug, but it’s very unusefriendly.

I think that changing ‘Response content type’ should also change ‘Parameter content type’ or do not change ‘Example Model’. It would be better.

Would anyone have an idea on how to change this behavior?

Thk,

Posts: 1

Participants: 1

Read full topic

Setting custom data for users by admin

$
0
0

@shaju wrote:

I need to create custom user settings for other users from the admin account.For that I used POST user/custom api and the example value contains user_id so that I can set custom data to any of the user that I want.Example post body in the api doc is {
“resource”: [
{
“user_id”: 0,
“name”: “string”,
“value”: “string”
}
],
“ids”: [
0
]
}
But when adding the data in user_custom table in database is with user_id of admin account,not the user_id I specified in the POST.Is there any solution to create custom settings for users from admin account.

Posts: 1

Participants: 1

Read full topic

Delete /system/cache/{service} delete /system/cache/{service} :: deleteServiceCache() - Delete cache for single service is not working from rest Client

$
0
0

@jaffer wrote:

Hi ,

Once I create a service and a table for the service I have tried deleting and re-iterate the same and i got the exception since it was holding the previous service configuration details.

I have tried service delete /system/cache/{service} present in System as service. but same failed in rest client

below are the params used to delete

Accept:application/json
X-DreamFactory-Api-Key:admin role api key
Authorization:Basic amFmZmVyc0BkaWdpdGFsaW5mdXppb24uY29tOkFtZWVuYTFA

Can you please help or provide assistance to do the Succesful deletion from rest client (postman) for the service.

An error got as below :

403 forbidden

Regards
jaffer

Posts: 1

Participants: 1

Read full topic


Is there a way to add virtual foreign key pointing to system/user in Dreamfactory 2.9?

$
0
0

@aurerua wrote:

Hi,

Is it possible to add a virtual foreign key pointing to a field in system/user in Dreamfactory 2.9 ?

Thanks in advance.

Posts: 1

Participants: 1

Read full topic

Impossible to save server script "Unknown column 'storage_service_id'"

$
0
0

@aurerua wrote:

Hi,

Whenever I try to save a script under "database._table.{my_table_name}.get.post_process, I get such an error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'storage_service_id' in 'field list' (SQL: insert into 
`event_script` (`name`, `type`, `content`, `is_active`, `allow_event_modification`, `storage_service_id`, `scm_repository`, 
`scm_reference`, `storage_path`, `created_by_id`, `last_modified_date`, `created_date`) values 
(database._table.participant.get.post_process, v8js, //var resource = event.response.content.resource;
var processedResource;
, 0, 0, , , , , 1, 2017-11-27 15:50:57, 2017-11-27 15:50:57))

In case it is relevant, the language of the Script is V8js.

Did someone run into a similar issue? Any idea what I could do?

Thanks in advance!

Posts: 1

Participants: 1

Read full topic

More tutorials please

$
0
0

@stevejohnson wrote:

I really like DreamFactory’s concept of having so many options to configure databases. But i think it lacks some good tutorials. Maybe a simple tut to make CRUD functions would be very helpful.

Just an advice, thank you for making this great open source product.

Posts: 1

Participants: 1

Read full topic

JSON response 'Invalid encoding, expecting UTF-8, UTF-16 or UTF-32.' Python post process

$
0
0

@ZTR_Syndeste wrote:

I have a simple API post-process Python script that converts the response from an invoked function to JSON from a string. The output looks great and can be parsed as expected, but I suspect the response header is not providing encoding information (or it may just be blank). Right now my script looks like this:

import json
content = event.response.content;
event.response.content = json.loads(content);
event.response.content_type = ‘application/json;charset=utf-8’;

Testing shows an error: “Invalid encoding, expecting UTF-8, UTF-16 or UTF-32.”

I have tried playing around with event.response.headers but I’ve not had any luck. Any thoughts would be appreciated. Thanks in advance.

Posts: 1

Participants: 1

Read full topic

Cannot post data to mysql

$
0
0

@EM_FLK wrote:

I am attempting to post the following JSON to my mysql database to add a new record.

 {
    "resource": {
      "code": "466767"
    },
    "ids": [
      0
    ],
    "filter": "string",
    "params": [
      "string"
    ]
  }

However the code i always get in response is:

No record(s) detected in request. Please make sure record(s) are wrapped in a ‘resource’ tag.

I have tried many things and I am out of ideas. The JSON works correctly when input into the live API docs.

Whole Code:

<?php
$verb = $event['request']['method'];

if ($verb !== 'GET') {
    // currently always throws a 500 to client
    throw new \Exception('Only HTTP GET is allowed on this endpoint');
}

$params = $event['request']['parameters'];
$required = ['jsonString', 'table'];

foreach ($required as $element) {
    if (!isset($params[$element])) {
        $event['response'] = [
            'status_code' => 400, 
            'content' => [
                'success' => false,
                'message' => "Required parameter $element not found in request."
            ]
        ];
        return;
    }
}


$tableUsed = $params['table'];

$json_data = ($params['jsonString']);
$lang_data = json_decode($json_data);


$url = 'http://52.169.200.242/api/v2/mysql/_table/'.$tableUsed.'/?api_key=813b0d263f902fc8118336c76779a019a6ba541eeca062b08e877a9f27a941bb';

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');

//open connection
$ch = curl_init($url);                                                                      
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $lang_data);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json'                                                                                
));   

//execute post
$result = curl_exec($ch);
$info = curl_getinfo($ch);

//close connection
curl_close($ch);
return [
    'result' => ($result)
    ];

Posts: 2

Participants: 2

Read full topic

Viewing all 1524 articles
Browse latest View live