The API specifies that when requesting a login form for a financial website, it would return a JSON Form object, but never specifies the nature of this object. API documentation on this topic here.
I need to write a parser so that I can insert the form as html into my page. Is there anywhere where I can find a parser, or at least see some documentation on this JSON Form object?
The article you linked shows the object that returns. You need to build the form based on that. For example when typeName is TEXT, you need to display a and when it's IF_PASSWORD you create a field of .
Related
My company is using a CKAN instance configured with Data Store and DataPusher. When a CSV file is uploaded to CKAN, DataPusher sends it to the DataStore and creates a default Data Dictionary for the resource. The Data Dictionary is a very nice feature to display the description of data fields for the users. Here is an example (it is in Brazilian Portuguese):
I can update the Data Dictionary using the UI, or it can be sent as part of the Fields passed to datastore_create().
My problem, is that I don't control the call of datastore_create() because this method is automatically called buy the DataPusher service.
I want to programmatically set the values of the Data Dictionary, but I can't find the api call that allows me to do it. An api call that update the Fields metadata. Can I do it using the Api? Or maybe it is possible create it when I create the data resource. I'd like a code example.
You can use the API call datastore_create on top of an existing table. This will not impact the data in the table.
You should use the datastore_search to check the format of how the dictionary is saved in one of your resources (result->fields->info). Use that as your base, make the desired changes, and use it in the body of the datastore_create call.
Unfortunately, the API call datastore_info does not give you back that information.
The majority of the CKAN UI functionalities can be made through the API as well. In this case, you can make use of the "datastore_create" by the controller --> See Code here.
Using react-admin, I have build an ExpressJS API including a GraphQL endpoint. All my resources in react-admin are using the graphql data provider. For a specific resource, I'm looking to fetch some configuration from my API endpoint to generate the form based on the context. I will try to create a mock example as I can't use the actual application's lingo.
For example, if I edit resource Post, and I assign a specific type "Photo", then I want some specific metadata to be saved in the form. My issue is the specific metadata object is coming from the API configuration for type "Photo". So if I select type "Photo", I want to save "Capture Date", "Camera Make", "Camera Model", etc.
The backend configuration would probably be in the form of a JSON schema describing the fields, the label, the key and the type of input (text or password).
TLDR: I want to fetch a configuration in the API and use it in the app to generate a list of form inputs. How can I do this without registering the call as a resource, since I don't feel like it is?
Edit
I haven't tried anything yet as I was asking a theoretical question to see if anybody had a "proper way" to suggest. My two options were the following:
Create a Resource for the PostType and it would simply return the list of fields as a JSONschema when called with GET_ONE. This would make use of the dataProvider to do the fetching.
Simply use fetch in my form and call my API endpoint directly.
For a project I'm working on, I need to access Custom Form data via the AtTask REST API. Specifically, I need to surface the text associated with any checked checkboxes within a custom form.
To see where this data might be visible, I've done a query of the form:
https://<company>.attasksandbox.com/attask/api/v4.0/task/search?method=get&sessionID=xxxxxxxx&fields=parameterValues
...but I'm not seeing the checkbox data I'm looking for.
Is it possible to surface this kind of data via the API?
If so, what's the proper syntax?
The parameterValues fields will return all the custom data that is set on the task. You can request the specific parameter by calling it by name like DE:Parameter Name. Both will only return the selected values of the checkbox. If you would like all values for the field then you will need to pull them from the parameter and parameter options objects.
https://<company>.attask-ondemand.com/attask/api/v4.0/popt/metadata
I am trying to parse a page on a wikia to get additional information for a Infobox Book template that is on the page. The problem is the I can only get the template's source instead of the transformed template on the page.
I'm using the following url as a base:
http://starwars.wikia.com/api.php?format=xml&action=expandtemplates&text={{Infobox%20Book}}&generatexml=1
The documentation doesn't really tell me how to point it to a specific page and parse the transformed template from the page. Is this even possible or do I need to parse it all myself?
To expand a template with the parameters from a given page, you will have to provide those parameters. There is no way for the API to know how the template is used in different pages (it could even be used twice!).
This works:
action=expandtemplates&text={{Infobox Book|book name=Lost Tribe of the Sith: Skyborn}}
You will, of course have to keep adding all the parameters you want to parse (there are 14 in your example).
If you have templates that change automatically depending on which page they are (that is not the case here), e.g. by making use of magic words such as {{PAGENAME}}, you can add &page=Lost_Tribe_of_the_Sith:_Skyborn to your API call, to set the context the template should be expanded in.
If you to not know the parameters given, you can either:
Render the whole page with index.php?action=render&title=Lost_Tribe_of_the_Sith:_Skyborn, and parse the returned html to carve out the actual infobox
Fetch (action=query&prop=revisions) and parse the wikicode to get the parameters to the template, and supply them to the expandtemplates call
Start using an extension like Semantic MediaWiki, that allows you to treat your wiki more like a database
1 and 2 can go wrong in any number of ways, of course, as with a wiki you have, by definition, no way of knowing that the content is always entered in a consistent way.
Using Ektron 8.02, I'm trying to retrieve the Post Back Message of an Html Form using only the API. I haven't been able to find a property on the Ektron.Cms.FormData object which provides this, nor any method in the `Ektron.Cms.API.Content.Form' class which will retrieve it. Is what I'm trying to do even possible through the API or should I instead attempt to get this from the database directly?
I've found it. To get all of the data from an Html Form you'll need to get the form as FormData and ContentData objects. Inside the ContentData.Teaser property is a bit of XML that contains the postback message among other things. Will have more information after I get back to my work machine.