Single fields endpoints:
 **************************************************************************
 This function create a new field for the post.
5217
def create_relay_field
      # find post field
      @post_field = LatoBlog::PostField.find_by(id: params[:post_field_id])
      unless @post_field
        @error = true
        respond_to { |r| r.js }
      end
      # find subfield info
      child_field_info = nil
      @post_field.meta_datas[:fields].each do |key, content|
        child_field_info = [key, content] if key == params[:key]
      end
      unless child_field_info
        @error = true
        respond_to { |r| r.js }
      end
      # prepare data to create field
      child_field_key = child_field_info.first
      child_field_content = child_field_info.last
      # override class and position
      child_field_content[:class] = nil
      child_field_content[:position] = !@post_field.post_fields.empty? ? @post_field.post_fields.order('position ASC').last.position + 1 : 1
      # create subfield for the post field
      blog__create_db_post_field(@post_field.post, child_field_key, child_field_content, @post_field)
      # send response to client
      @error = false
      respond_to { |r| r.js }
    end
605579
def ticket_field_option_create(self, field_id, id, data, **kwargs):
        ""
        api_path = "/api/v2/ticket_fields/{field_id}/options/{id}.json"
        api_path = api_path.format(field_id=field_id, id=id)
        return self.call(api_path, method="POST", data=data, **kwargs)
666251
function create_field( $field )
	{
		// global
		global $post;
		
		
		// vars
		$args = array(
			'numberposts' => -1,
			'post_type' => null,
			'orderby' => 'title',
			'order' => 'ASC',
			'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
			'suppress_filters' => false,
		);
		
		
		// load all post types by default
		if( in_array('all', $field['post_type']) )
		{
			$field['post_type'] = apply_filters('acf/get_post_types', array());
		}
		
		
		// create tax queries
		if( ! in_array('all', $field['taxonomy']) )
		{
			// vars
			$taxonomies = array();
			$args['tax_query'] = array();
			
			foreach( $field['taxonomy'] as $v )
			{
				
				// find term (find taxonomy!)
				// $term = array( 0 => $taxonomy, 1 => $term_id )
				$term = explode(':', $v); 
				
				
				// validate
				if( !is_array($term) || !isset($term[1]) )
				{
					continue;
				}
				
				
				// add to tax array
				$taxonomies[ $term[0] ][] = $term[1];
				
			}
			
			
			// now create the tax queries
			foreach( $taxonomies as $k => $v )
			{
				$args['tax_query'][] = array(
					'taxonomy' => $k,
					'field' => 'id',
					'terms' => $v,
				);
			}
		}
		
		
		// Change Field into a select
		$field['type'] = 'select';
		$field['choices'] = array();
		
		
		foreach( $field['post_type'] as $post_type )
		{
			// set post_type
			$args['post_type'] = $post_type;
			
			
			// set order
			$get_pages = false;
			if( is_post_type_hierarchical($post_type) && !isset($args['tax_query']) )
			{
				$args['sort_column'] = 'menu_order, post_title';
				$args['sort_order'] = 'ASC';
				
				$get_pages = true;
			}
			
			
			// filters
			$args = apply_filters('acf/fields/post_object/query', $args, $field, $post);
			$args = apply_filters('acf/fields/post_object/query/name=' . $field['_name'], $args, $field, $post );
			$args = apply_filters('acf/fields/post_object/query/key=' . $field['key'], $args, $field, $post );
			
			
			if( $get_pages )
			{
				$posts = get_pages( $args );
			}
			else
			{
				$posts = get_posts( $args );
			}
			
			
			if($posts) {
				
				foreach( $posts as $p ) {
					
					// title
					$title = get_the_title( $p->ID );
					
					
					// empty
					if( $title === '' ) {
						
						$title = __('(no title)', 'acf');
						
					}
					
					
					// ancestors
					if( $p->post_type != 'attachment' ) {
						
						$ancestors = get_ancestors( $p->ID, $p->post_type );
						
						$title = str_repeat('- ', count($ancestors)) . $title;
						
					}
					
					
					// status
					if( get_post_status( $p->ID ) != "publish" ) {
						
						$title .= ' (' . get_post_status( $p->ID ) . ')';
						
					}
					
					
					// WPML
					if( defined('ICL_LANGUAGE_CODE') ) {
						
						$title .= ' (' . ICL_LANGUAGE_CODE . ')';
						
					}
					
					
					// filters
					$title = apply_filters('acf/fields/post_object/result', $title, $p, $field, $post);
					$title = apply_filters('acf/fields/post_object/result/name=' . $field['_name'] , $title, $p, $field, $post);
					$title = apply_filters('acf/fields/post_object/result/key=' . $field['key'], $title, $p, $field, $post);
					
					
					// add to choices
					if( count($field['post_type']) == 1 )
					{
						$field['choices'][ $p->ID ] = $title;
					}
					else
					{
						// group by post type
						$post_type_object = get_post_type_object( $p->post_type );
						$post_type_name = $post_type_object->labels->name;
					
						$field['choices'][ $post_type_name ][ $p->ID ] = $title;
					}
					
					
				}
				// foreach( $posts as $post )
			}
			// if($posts)
		}
		// foreach( $field['post_type'] as $post_type )
		
		
		// create field
		do_action('acf/create_field', $field );
	}
874247
function action_putpost(si,args,done) {
    var ent_type = parse_ent(args)

    var ent = si.make(ent_type.zone,ent_type.base,ent_type.name)

    var data = args.data || {}

    var good = _.filter(_.keys(data),function(k){return !~k.indexOf('$')})

    var fields = _.pick(data,good)
    ent.data$(fields)

    if( null != ent_type.entid ) {
      ent.id = ent_type.entid
    }
    else if( null != data.id$ && options.allow_id ) {
      ent.id$ = data.id$
    }

    save_aspect(si,{args:args,ent:ent},done,function(ctxt,done){
      ctxt.ent.save$(function(err,ent){
        var data = ent ? ent.data$(true,'string') : null
        done(err, data)
      })
    })
  }
412184
def post(self, endpoint, params=None, version='1.1', json_encoded=False):
        """"""
        return self.request(endpoint, 'POST', params=params, version=version, json_encoded=json_encoded)
1333572
public function postDataFields(
        $data,
        $type = 'String',
        $visibility = 'public',
        $defaultValue = false
    ) {
        $url = $this->getApiEndpoint() . self::REST_DATA_FILEDS;
        //set default value for the numeric datatype
        if ($type == 'numeric' && !$defaultValue) {
            $defaultValue = 0;
        }
        //set data for the string datatype
        if (is_string($data)) {
            $data = [
                'Name' => $data,
                'Type' => $type,
                'Visibility' => $visibility,
            ];
            //default value
            if ($defaultValue) {
                $data['DefaultValue'] = $defaultValue;
            }
        }
        $this->setUrl($url)
            ->buildPostBody($data)
            ->setVerb('POST');

        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'POST CREATE DATAFIELDS ' . $response->message;
            $this->helper->debug('postDataFields', [$message]);
            $this->helper->debug('postDataFields', $data);
        }

        return $response;
    }
92680
def add_field(field, data_type = nil, options = {})
      data_type = DataType::String if data_type.nil?
      puts [":#{field}", "#{data_type.class.to_s}", "#{options.inspect}"].collect { |s| s.ljust(25) }.join if ENV['DEBUG']
      
      # Fields that do special things go here.
      if field == :timestamps
        add_field(:updated_at, :datetime)
        add_field(:created_at, :datetime)
        return true
      end

      # Add index if explicitly asked
      @indexes << field if options.delete(:index) || data_type.class.to_s == 'Hash' && data_type.delete(:index)
      @validations[field] = options.delete(:validates) if options[:validates]
      options.merge!(:field => field)    
      
      # Matches: description DataType::Paragraph, :index => true
      if data_type.is_a?(Class) && data_type.respond_to?(:migrant_data_type?)
        @columns[field] = data_type.new(options)
      # Matches: description :index => true, :unique => true
      else
        begin
          # Eg. "My field" -> String -> DataType::String
          @columns[field] = "DataType::#{data_type.class.to_s}".constantize.new(options.merge(:value => data_type))
        rescue NameError
          # We don't have a matching type, throw a warning and default to string
          puts "MIGRATION WARNING: No migration implementation for class #{data_type.class.to_s} on field '#{field}', defaulting to string..."
          @columns[field] = DataType::Base.new(options)
        end
      end
    end
476290
function createEndpointFromPath(path, query, filePath) {
  filePath = filePath || path;
  return createEndpointFromObject(path, query, getJSON(filePath));
}
1000333
def put(self, endpoint, **kwargs):
        
        kwargs.update(self.kwargs.copy())
        if "data" in kwargs:
            kwargs["headers"].update(
                {"Content-Type": "application/json;charset=UTF-8"})
        response = requests.put(self.make_url(endpoint), **kwargs)
        return _decode_response(response)
1303854
def render_post_fields(post)
      post_fields = post.post_fields.visibles.roots.order('position ASC')
      render 'lato_blog/back/posts/shared/fields', post_fields: post_fields
    end
423506
function create_field( $field )
	{
		// require the googlemaps JS ( this script is now lazy loaded via JS )
		//wp_enqueue_script('acf-googlemaps');
		
		
		// default value
		if( !is_array($field['value']) )
		{
			$field['value'] = array();
		}
		
		$field['value'] = wp_parse_args($field['value'], array(
			'address'	=> '',
			'lat'		=> '',
			'lng'		=> ''
		));
		
		
		// default options
		foreach( $this->default_values as $k => $v )
		{
			if( ! $field[ $k ] )
			{
				$field[ $k ] = $v;
			}	
		}
		
		
		// vars
		$o = array(
			'class'		=>	'',
		);
		
		if( $field['value']['address'] )
		{
			$o['class'] = 'active';
		}
		
		
		$atts = '';
		$keys = array( 
			'data-id'	=> 'id', 
			'data-lat'	=> 'center_lat',
			'data-lng'	=> 'center_lng',
			'data-zoom'	=> 'zoom'
		);
		
		foreach( $keys as $k => $v )
		{
			$atts .= ' ' . $k . '="' . esc_attr( $field[ $v ] ) . '"';	
		}
		
		?>
		<div class="acf-google-map <?php echo $o['class']; ?>" <?php echo $atts; ?>>
			
			<div style="display:none;">
				<?php foreach( $field['value'] as $k => $v ): ?>
					<input type="hidden" class="input-<?php echo $k; ?>" name="<?php echo esc_attr($field['name']); ?>[<?php echo $k; ?>]" value="<?php echo esc_attr( $v ); ?>" />
				<?php endforeach; ?>
			</div>
			
			<div class="title">
				
				<div class="has-value">
					<a href="#" class="acf-sprite-remove ir" title="<?php _e("Clear location",'acf'); ?>">Remove</a>
					<h4><?php echo $field['value']['address']; ?></h4>
				</div>
				
				<div class="no-value">
					<a href="#" class="acf-sprite-locate ir" title="<?php _e("Find current location",'acf'); ?>">Locate</a>
					<input type="text" placeholder="<?php _e("Search for address...",'acf'); ?>" class="search" />
				</div>
				
			</div>
			
			<div class="canvas" style="height: <?php echo $field['height']; ?>px">
				
			</div>
			
		</div>
		<?php
	}
913805
def serialize_fields
      serialized = {}
      post_fields.visibles.roots.order('position ASC').each do |post_field|
        serialized[post_field.key] = post_field.serialize_base
      end
      serialized
    end
496522
def _generate_view(self, method, endpoint):
        

        def new_view(**kwargs):
            if method == Method.GET:
                data = request.args
            else:
                content_length = request.headers.get('content-length', 0)
                if content_length and int(content_length) > 0:
                    content_type = request.headers.get('content-type', None)
                    if content_type != 'application/vnd.api+json':
                        data = MissingContentTypeError().data
                        data = json.dumps(data, cls=JSONAPIEncoder)
                        response = make_response(data)
                        response.status_code = 409
                        response.content_type = 'application/vnd.api+json'
                        return response
                    data = request.get_json(force=True)
                else:
                    data = None

            event_kwargs = {
                'method': method,
                'endpoint': endpoint,
                'data': data,
                'req_args': kwargs
            }
            results = self.on_request.send(self, **event_kwargs)
            data = override(data, results)

            args = [self.sqla.session, data, kwargs['api_type']]
            if 'obj_id' in kwargs.keys():
                args.append(kwargs['obj_id'])
            if 'relationship' in kwargs.keys():
                args.append(kwargs['relationship'])

            try:
                attr = '{}_{}'.format(method.name, endpoint.name).lower()
                handler = getattr(self.serializer, attr)
                handler_chain = list(self._handler_chains.get((
                    kwargs['api_type'], method, endpoint), []))
                handler_chain.append(handler)
                chained_handler = self._call_next(handler_chain)
                response = chained_handler(*args)
                results = self.on_success.send(self,
                                               response=response,
                                               **event_kwargs)
                response = override(response, results)
            except BaseError as exc:
                self.sqla.session.rollback()
                results = self.on_error.send(self, error=exc, **event_kwargs)
                response = override(exc, results)
            rendered_response = make_response('')
            if response.status_code != 204:
                data = json.dumps(response.data, cls=self.json_encoder)
                rendered_response = make_response(data)
            rendered_response.status_code = response.status_code
            rendered_response.content_type = 'application/vnd.api+json'
            results = self.on_response.send(self,
                                            response=rendered_response,
                                            **event_kwargs)
            return override(rendered_response, results)

        return new_view
951617
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new FieldOptions();
			case 1:
				return new FieldOptions(func_get_arg(0));
			case 2:
				return new FieldOptions(func_get_arg(0), func_get_arg(1));
			case 3:
				return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
1031062
function Base(client, endpoint) {
	var base = this;

	/**
	 * Get a list of all records for the current API
	 *
	 * @method list
	 * @param {Object} query - OPTIONAL querystring params
	 * @param {Function} callback
	 */
	base.list = function() {
		return function(query, callback) {
			var q = '';

			if (query && 'function' === typeof callback)
				q = '?' + querystring.stringify(query);

			client.exec({
				path: '/' + endpoint + q
			}, arguments[arguments.length - 1]);
		};
	};

	/**
	 * Get a single record by its key
	 *
	 * @method fetch
	 * @param {Integer|String} key
	 * @param {Function} callback
	 */
	base.fetch = function() {
		return function(key, callback) {
			client.exec({
				path: '/' + endpoint + '/' + key
			}, callback);
		};
	};

	/**
	 * Create a new record
	 *
	 * @method create
	 * @param {Object|String} data
	 * @param {Function} callback
	 */
	base.create = function() {
		return function(data, callback) {
			client.exec({
				method: 'POST',
				path: '/' + endpoint,
				body: data
			}, callback);
		};
	};

	/**
	 * Update a record
	 *
	 * @method update
	 * @param {Integer|String} key
	 * @param {Object|String} data
	 * @param {Function} callback
	 */
	base.update = function() {
		return function(key, data, callback) {
			client.exec({
				method: 'PUT',
				path: '/' + endpoint + '/' + key,
				body: data
			}, callback);
		};
	};

	/**
	 * Remove a record
	 *
	 * @method remove
	 * @param {Integer|String} key
	 * @param {Function} callback
	 */
	base.remove = function() {
		return function(key, callback) {
			client.exec({
				method: 'DELETE',
				path: '/' + endpoint + '/' + key
			}, callback);
		};
	};

	/**
	 * Do requested action
	 *
	 * @method doAction
	 * @param {Integer|String} key
	 * @param {String} action
	 * @param {Object} body
	 * @param {Function} callback
	 */
	base.doAction = function() {
		return function(key, action, body, callback) {
			body = body || {};
			body.type = action;

			client.exec({
				method: 'POST',
				path: '/' + endpoint + '/' + key + '/actions',
				body: body
			}, callback);
		};
	};
}
647787
def post(self, endpoint, **kwargs):
        
        return self._request(requests.post, endpoint, **kwargs)
391091
function createUnitField(data, schema) {
    data = data || [];
    let partialField;

    switch (schema.type) {
    case FieldType.MEASURE:
        switch (schema.subtype) {
        case MeasureSubtype.CONTINUOUS:
            partialField = new PartialField(schema.name, data, schema, new ContinuousParser());
            return new Continuous(partialField, `0-${data.length - 1}`);
        default:
            partialField = new PartialField(schema.name, data, schema, new ContinuousParser());
            return new Continuous(partialField, `0-${data.length - 1}`);
        }
    case FieldType.DIMENSION:
        switch (schema.subtype) {
        case DimensionSubtype.CATEGORICAL:
            partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
            return new Categorical(partialField, `0-${data.length - 1}`);
        case DimensionSubtype.TEMPORAL:
            partialField = new PartialField(schema.name, data, schema, new TemporalParser(schema));
            return new Temporal(partialField, `0-${data.length - 1}`);
        case DimensionSubtype.BINNED:
            partialField = new PartialField(schema.name, data, schema, new BinnedParser());
            return new Binned(partialField, `0-${data.length - 1}`);
        default:
            partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
            return new Categorical(partialField, `0-${data.length - 1}`);
        }
    default:
        partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
        return new Categorical(partialField, `0-${data.length - 1}`);
    }
}